From 641cc38811b7afa3f0d8433a5bb7dcca56fa449c Mon Sep 17 00:00:00 2001 From: Solomon Laing Date: Tue, 23 Aug 2022 17:03:37 +0930 Subject: [PATCH] updated, pretty much finished, nvim config :D --- .config/nvim/init.lua | 19 ++- .config/nvim/lua/user/alpha.lua | 44 ++++- .config/nvim/lua/user/autocommands.lua | 27 +-- .config/nvim/lua/user/browse.lua | 7 +- .config/nvim/lua/user/cmp.lua | 23 +-- .config/nvim/lua/user/copilot.lua | 4 + .config/nvim/lua/user/harpoon.lua | 1 + .config/nvim/lua/user/hop.lua | 3 + .config/nvim/lua/user/icons.lua | 221 +++++++++++++------------ .config/nvim/lua/user/illuminate.lua | 14 +- .config/nvim/lua/user/keymaps.lua | 16 +- .config/nvim/lua/user/lsp/handlers.lua | 21 ++- .config/nvim/lua/user/navic.lua | 54 +++--- .config/nvim/lua/user/neoscroll.lua | 4 +- .config/nvim/lua/user/plugins.lua | 9 +- .config/nvim/lua/user/toggleterm.lua | 2 +- .config/nvim/lua/user/whichkey.lua | 70 +------- 17 files changed, 248 insertions(+), 291 deletions(-) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index c88b0c6..5a5308d 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -14,7 +14,7 @@ require("user.comment") require("user.gitsigns") require("user.nvim-tree") require("user.bufferline") -require("user.toggleterm") +require("user.toggleterm") -- Need to look into this and how it's configured. require("user.project") require("user.impatient") require("user.indentline") @@ -23,26 +23,27 @@ require("user.whichkey") -- Not sure I want to use this yet. -- require "user.hop" require("user.matchup") -require "user.numb" +require("user.numb") require("user.colorizer") -require "user.spectre" +require("user.spectre") require("user.zen-mode") require("user.neoscroll") require("user.todo-comments") -require("user.symbol-outline") +require("user.symbol-outline") -- not working? look into further... require("user.notify") require("user.ts-context") -- I can look at this in Chritian Chiarulli's config if I wish, for now I can't be bothered. -- require("user.copilot") require("user.functions") require("user.illuminate") -require("user.dap") -require "user.lir" +require("user.dap") -- Need to work this one out. +-- require("user.lir") require("user.winbar") require("user.nvim-webdev-icons") -require "user.fidget" +require("user.fidget") +require("user.dressing") require("user.browse") -require("user.surround") -require("user.harpoon") +require("user.surround") -- This need reconfiguration and fixing +require("user.harpoon") -- mark files and navigate them through a nice ui or with keys (good for large codebases) require("user.vim-slash") require("user.lualine") diff --git a/.config/nvim/lua/user/alpha.lua b/.config/nvim/lua/user/alpha.lua index 2910959..43f0b1f 100644 --- a/.config/nvim/lua/user/alpha.lua +++ b/.config/nvim/lua/user/alpha.lua @@ -13,14 +13,40 @@ end local icons = require "user.icons" +-- dashboard.section.header.val = { +-- [[ __ ]], +-- [[ ___ ___ ___ __ __ /\_\ ___ ___ ]], +-- [[ / _ `\ / __`\ / __`\/\ \/\ \\/\ \ / __` __`\ ]], +-- [[/\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]], +-- [[\ \_\ \_\ \____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]], +-- [[ \/_/\/_/\/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]], +-- } + +-- dashboard.section.header.val = { +-- [[ ▟▙ ]], +-- [[ ▝▘ ]], +-- [[ ██▃▅▇█▆▖ ▗▟████▙▖ ▄████▄ ██▄ ▄██ ██ ▗▟█▆▄▄▆█▙▖]], +-- [[ ██▛▔ ▝██ ██▄▄▄▄██ ██▛▔▔▜██ ▝██ ██▘ ██ ██▛▜██▛▜██]], +-- [[ ██ ██ ██▀▀▀▀▀▘ ██▖ ▗██ ▜█▙▟█▛ ██ ██ ██ ██]], +-- [[ ██ ██ ▜█▙▄▄▄▟▊ ▀██▙▟██▀ ▝████▘ ██ ██ ██ ██]], +-- [[ ▀▀ ▀▀ ▝▀▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀]], +-- } + +-- ▄▀▀▄ ▀▄ ▄▀▀█▄▄▄▄ ▄▀▀▀▀▄ ▄▀▀▄ ▄▀▀▄ ▄▀▀█▀▄ ▄▀▀▄ ▄▀▄ +-- █ █ █ █ ▐ ▄▀ ▐ █ █ █ █ █ █ █ █ █ █ ▀ █ +-- ▐ █ ▀█ █▄▄▄▄▄ █ █ ▐ █ █ ▐ █ ▐ ▐ █ █ +-- █ █ █ ▌ ▀▄ ▄▀ █ ▄▀ █ █ █ +-- ▄▀ █ ▄▀▄▄▄▄ ▀▀▀▀ ▀▄▀ ▄▀▀▀▀▀▄ ▄▀ ▄▀ +-- █ ▐ █ ▐ █ █ █ █ +-- ▐ ▐ ▐ ▐ ▐ ▐ + dashboard.section.header.val = { - [[ __ ]], - [[ ___ ___ ___ __ __ /\_\ ___ ___ ]], - [[ / _ `\ / __`\ / __`\/\ \/\ \\/\ \ / __` __`\ ]], - [[/\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]], - [[\ \_\ \_\ \____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]], - [[ \/_/\/_/\/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]], +[[ , __ ___ __. _ __ ` , _ , _ ]], +[[ |' `. .' ` .' \ | / | |' `|' `.]], +[[ | | |----' | | ` / | | | |]], +[[ / | `.___, `._.' \/ / / ' /]], } + dashboard.section.buttons.val = { button("f", icons.documents.Files .. " Find file", ":Telescope find_files "), button("e", icons.ui.NewFile .. " New file", ":ene startinsert "), @@ -37,7 +63,11 @@ local function footer() -- local fortune = handle:read("*a") -- handle:close() -- return fortune - return "inkletblot.com" + return { + [[┬┌┐┌┬┌─┬ ┌─┐┌┬┐┌┐ ┬ ┌─┐┌┬┐┌─┐┌─┐┌┬┐]], + [[││││├┴┐│ ├┤ │ ├┴┐│ │ │ │ │ │ ││││]], + [[┴┘└┘┴ ┴┴─┘└─┘ ┴ └─┘┴─┘└─┘ ┴o└─┘└─┘┴ ┴]], + } end dashboard.section.footer.val = footer() diff --git a/.config/nvim/lua/user/autocommands.lua b/.config/nvim/lua/user/autocommands.lua index 3e1a0cc..bff2471 100644 --- a/.config/nvim/lua/user/autocommands.lua +++ b/.config/nvim/lua/user/autocommands.lua @@ -38,17 +38,6 @@ vim.api.nvim_create_autocmd({ "FileType" }, { end, }) -vim.api.nvim_create_autocmd({ "FileType" }, { - pattern = { "Jaq" }, - callback = function() - vim.cmd [[ - nnoremap :close - " nnoremap - set nobuflisted - ]] - end, -}) - vim.api.nvim_create_autocmd({ "BufEnter" }, { pattern = { "" }, callback = function() @@ -170,17 +159,6 @@ vim.api.nvim_create_autocmd({ "CursorHold" }, { end, }) --- vim.api.nvim_create_autocmd({ "ModeChanged" }, { --- callback = function() --- local luasnip = require "luasnip" --- if luasnip.expand_or_jumpable() then --- -- ask maintainer for option to make this silent --- -- luasnip.unlink_current() --- vim.cmd [[silent! lua require("luasnip").unlink_current()]] --- end --- end, --- }) - vim.api.nvim_create_autocmd({ "BufWritePost" }, { pattern = { "*.ts" }, callback = function() @@ -188,10 +166,13 @@ vim.api.nvim_create_autocmd({ "BufWritePost" }, { end, }) +-- Prevent auto comment on next line vim.cmd [[autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o]] +-- Set filetype to tex for .tex files? vim.cmd [[autocmd BufRead,BufNewFile *.tex set filetype=tex]] +-- Trim whitespace from files on save vim.cmd [[ autocmd BufWritePre * let currPos = getpos(".") autocmd BufWritePre * %s/\s\+$//e @@ -200,6 +181,8 @@ autocmd BufWritePre *.[ch] %s/\%$/\r/e autocmd BufWritePre * cal cursor(currPos[1], currPos[2]) ]] +-- Recompile and restart Xmonad on save of config file for Xmonad or Xmobar vim.cmd [[autocmd BufWritePost ~/.xmonad/xmonad.hs,~/.config/xmobar/xmobar-main.hs,~/.config/xmobar/xmobar-sub.hs,~/.config/xmobar/xmobar-single.hs !xmonad --recompile && xmonad --restart]] +-- Run custom textclear command when exiting a .tex file (cleanup files) vim.cmd [[autocmd VimLeave *.tex !texclear %]] diff --git a/.config/nvim/lua/user/browse.lua b/.config/nvim/lua/user/browse.lua index a70285c..d69bb55 100644 --- a/.config/nvim/lua/user/browse.lua +++ b/.config/nvim/lua/user/browse.lua @@ -8,6 +8,7 @@ browse.setup { } local bookmarks = { + "https://duckduckgo.com/", "https://www.chrisatmachine.com/", "https://github.com/christianchiarulli", "https://github.com/rockerBOO/awesome-neovim", @@ -15,8 +16,6 @@ local bookmarks = { "https://doc.rust-lang.org/book/", "https://aur.archlinux.org/packages/", "https://news.ycombinator.com/", - -- "https://github.com/neovim/neovim", - -- "https://neovim.discourse.group/", } local function command(name, rhs, opts) @@ -53,4 +52,6 @@ local opts = { noremap = true, silent = true } local keymap = vim.api.nvim_set_keymap keymap("n", "", "BrowseBookmarks", opts) -keymap("n", "", "BrowseInputSearch", opts) + +-- Broken, causes segfault. +-- keymap("n", "", "BrowseInputSearch", opts) diff --git a/.config/nvim/lua/user/cmp.lua b/.config/nvim/lua/user/cmp.lua index 0b6c9bf..18381e9 100644 --- a/.config/nvim/lua/user/cmp.lua +++ b/.config/nvim/lua/user/cmp.lua @@ -28,11 +28,6 @@ local compare = require "cmp.config.compare" require("luasnip/loaders/from_vscode").lazy_load() --- local check_backspace = function() --- local col = vim.fn.col "." - 1 --- return col == 0 or vim.fn.getline("."):sub(col, col):match "%s" --- end - local check_backspace = function() local line, col = unpack(vim.api.nvim_win_get_cursor(0)) return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil @@ -42,6 +37,7 @@ local icons = require "user.icons" local kind_icons = icons.kind +-- I don't have most of the following but they can serve as future examples vim.api.nvim_set_hl(0, "CmpItemKindCopilot", { fg = "#6CC644" }) vim.api.nvim_set_hl(0, "CmpItemKindTabnine", { fg = "#CA42F0" }) vim.api.nvim_set_hl(0, "CmpItemKindEmoji", { fg = "#FDE030" }) @@ -69,7 +65,6 @@ cmp.setup { [""] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), [""] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), -- [""] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `` mapping. [""] = cmp.mapping { i = cmp.mapping.abort(), @@ -170,15 +165,11 @@ cmp.setup { end, }, sources = { - { name = "crates", group_index = 1 }, + { + name = "crates", group_index = 1 }, { name = "copilot", - -- keyword_length = 0, max_item_count = 3, - -- trigger_characters = { - -- { ".", ":", "(", "'", '"', "[", ",", "#", "*", "@", "|", "=", "-", "{", "/", "\\", "+", "?", " ", "\t", "\n" }, - -- }, - group_index = 2, }, { @@ -213,8 +204,6 @@ cmp.setup { sorting = { priority_weight = 2, comparators = { - -- require("copilot_cmp.comparators").prioritize, - -- require("copilot_cmp.comparators").score, compare.offset, compare.exact, -- compare.scopes, @@ -225,8 +214,6 @@ cmp.setup { compare.sort_text, compare.length, compare.order, - -- require("copilot_cmp.comparators").prioritize, - -- require("copilot_cmp.comparators").score, }, }, confirm_opts = { @@ -235,10 +222,6 @@ cmp.setup { }, window = { documentation = false, - -- documentation = { - -- border = "rounded", - -- winhighlight = "NormalFloat:Pmenu,NormalFloat:Pmenu,CursorLine:PmenuSel,Search:None", - -- }, completion = { border = "rounded", winhighlight = "NormalFloat:Pmenu,NormalFloat:Pmenu,CursorLine:PmenuSel,Search:None", diff --git a/.config/nvim/lua/user/copilot.lua b/.config/nvim/lua/user/copilot.lua index 618db8f..7d31346 100644 --- a/.config/nvim/lua/user/copilot.lua +++ b/.config/nvim/lua/user/copilot.lua @@ -1,3 +1,7 @@ +-- NOTE! +-- I AM NOT USING THIS, IT'S HERE IF I CHOOSE TO IN THE FUTURE! +-- PROBABLY NOT THOUGH... + -- For copilot.vim -- vim.g.copilot_filetypes = { -- ["*"] = false, diff --git a/.config/nvim/lua/user/harpoon.lua b/.config/nvim/lua/user/harpoon.lua index e7b60e5..3b0eaaf 100644 --- a/.config/nvim/lua/user/harpoon.lua +++ b/.config/nvim/lua/user/harpoon.lua @@ -7,4 +7,5 @@ local h_status_ok, harpoon = pcall(require, "harpoon") if not h_status_ok then return end + telescope.load_extension "harpoon" diff --git a/.config/nvim/lua/user/hop.lua b/.config/nvim/lua/user/hop.lua index 56dab4e..f6c1f3e 100644 --- a/.config/nvim/lua/user/hop.lua +++ b/.config/nvim/lua/user/hop.lua @@ -1,3 +1,6 @@ +-- NOTE! +-- Not using this currently, might be useful in future but for now I'm happy with default nvim. + local status_ok, hop = pcall(require, "hop") if not status_ok then return diff --git a/.config/nvim/lua/user/icons.lua b/.config/nvim/lua/user/icons.lua index 230f020..f1fa05c 100644 --- a/.config/nvim/lua/user/icons.lua +++ b/.config/nvim/lua/user/icons.lua @@ -2,112 +2,115 @@ -- go to the above and then enter u and the symbold should appear -- or go here and upload the font file: https://mathew-kurian.github.io/CharacterMap/ -- find more here: https://www.nerdfonts.com/cheat-sheet - return { - kind = { - Text = "", - -- Method = "m", - -- Function = "", - -- Constructor = "", - Method = "", - Function = "", - Constructor = "", - Field = "", - -- Variable = "", - Variable = "", - Class = "", - Interface = "", - -- Module = "", - Module = "", - Property = "", - Unit = "", - Value = "", - Enum = "", - -- Keyword = "", - Keyword = "", - -- Snippet = "", - Snippet = "", - Color = "", - File = "", - Reference = "", - Folder = "", - EnumMember = "", - Constant = "", - Struct = "", - Event = "", - Operator = "", - TypeParameter = "", - }, - type = { - Array = "", - Number = "", - String = "", - Boolean = "蘒", - Object = "", - }, - documents = { - File = "", - Files = "", - Folder = "", - OpenFolder = "", - }, - git = { - Add = "", - Mod = "", - Remove = "", - Ignore = "", - Rename = "", - Diff = "", - Repo = "", - Octoface = "", - }, - ui = { - ArrowClosed = "", - ArrowOpen = "", - Lock = "", - Circle = "", - BigCircle = "", - BigUnfilledCircle = "", - Close = "", - NewFile = "", - Search = "", - Lightbulb = "", - Project = "", - Dashboard = "", - History = "", - Comment = "", - Bug = "", - Code = "", - Telescope = "", - Gear = "", - Package = "", - List = "", - SignIn = "", - SignOut = "", - Check = "", - Fire = "", - Note = "", - BookMark = "", - Pencil = "", - -- ChevronRight = "", - ChevronRight = ">", - Table = "", - Calendar = "", - CloudDownload = "", - }, - diagnostics = { - Error = "", - Warning = "", - Information = "", - Question = "", - Hint = "", - }, - misc = { - Robot = "ﮧ", - Squirrel = "", - Tag = "", - Watch = "", - Smiley = "ﲃ", - Package = "", - CircuitBoard = "", - }, - } +return { + kind = { + Text = "", + -- Method = "m", + Function = "", + -- Constructor = "", + Method = "", + -- Function = "", + Constructor = "", + Field = "", + -- Variable = "", + Variable = "", + Namespace = "פּ", + Class = "", + Interface = "", + -- Module = "", + Module = "", + Property = "", + Unit = "", + Value = "", + Enum = "", + Key = "k", + -- Keyword = "", + Keyword = "", + -- Snippet = "", + Snippet = "", + Color = "", + File = "", + Reference = "", + Folder = "", + EnumMember = "", + Constant = "", + Struct = "", + Event = "", + Operator = "", + TypeParameter = "", + }, + type = { + Array = "", + Number = "", + String = "", + Boolean = "蘒", + Null = "ﳠ", + Object = "", + }, + documents = { + File = "", + Files = "", + Folder = "", + OpenFolder = "", + }, + git = { + Add = "", + Mod = "", + Remove = "", + Ignore = "", + Rename = "", + Diff = "", + Repo = "", + Octoface = "", + }, + ui = { + ArrowClosed = "", + ArrowOpen = "", + Lock = "", + Circle = "", + BigCircle = "", + BigUnfilledCircle = "", + Close = "", + NewFile = "", + Search = "", + Lightbulb = "", + Project = "", + Dashboard = "", + History = "", + Comment = "", + Bug = "", + Code = "", + Telescope = "", + Gear = "", + Package = "", + List = "", + SignIn = "", + SignOut = "", + Check = "", + Fire = "", + Note = "", + BookMark = "", + Pencil = "", + -- ChevronRight = "", + ChevronRight = ">", + Table = "", + Calendar = "", + CloudDownload = "", + }, + diagnostics = { + Error = "", + Warning = "", + Information = "", + Question = "", + Hint = "", + }, + misc = { + Robot = "ﮧ", + Squirrel = "", + Tag = "", + Watch = "", + Smiley = "ﲃ", + Package = "", + CircuitBoard = "", + }, +} diff --git a/.config/nvim/lua/user/illuminate.lua b/.config/nvim/lua/user/illuminate.lua index 2b6c013..e5dac41 100644 --- a/.config/nvim/lua/user/illuminate.lua +++ b/.config/nvim/lua/user/illuminate.lua @@ -1,3 +1,11 @@ -vim.g.Illuminate_ftblacklist = { "alpha", "NvimTree", "DressingSelect", "harpoon" } -vim.api.nvim_set_keymap("n", "", 'lua require"illuminate".next_reference{wrap=true}', { noremap = true }) -vim.api.nvim_set_keymap("n", "", 'lua require"illuminate".next_reference{reverse=true,wrap=true}', { noremap = true }) +require('illuminate').configure({ + providers = { + 'lsp', + 'treesitter', + 'regex', + }, + delay = 100, + filetypes_denylist = { + 'alpha', + }, +}) diff --git a/.config/nvim/lua/user/keymaps.lua b/.config/nvim/lua/user/keymaps.lua index f0f553f..f67a95a 100644 --- a/.config/nvim/lua/user/keymaps.lua +++ b/.config/nvim/lua/user/keymaps.lua @@ -57,15 +57,8 @@ keymap("n", "o", ":setlocal spell! spelllang=en_us", opts) -- Tree keymap("n", "n", ":NvimTreeToggle", opts) --- Telescope -keymap("n", "ff", ":Telescope find_files", opts) -keymap("n", "ft", ":Telescope live_grep", opts) -keymap("n", "fp", ":Telescope projects", opts) -keymap("n", "fb", ":Telescope buffers", opts) -keymap("n", "fr", ":Telescope oldfiles", opts) - -- Goyo -keymap("n", "f", ":Goyo", opts) +-- keymap("n", "f", ":Goyo", opts) -- Copy and Paste keymap("n", "", '"+y', opts) @@ -88,7 +81,6 @@ keymap("n", "w!!", 'execute "silent! write !sudo tee % >/dev/null" edit!', -- ZenMode keymap("n", "", "ZenMode", opts) --- Temporary till I work out whichkey. -keymap("n", "gr", "lua vim.lsp.buf.references()", opts) -keymap("n", "gd", "lua vim.lsp.buf.definition()", opts) -keymap("n", "gi", "lua vim.lsp.buf.implementation()", opts) +-- Save +keymap("i", "", ":wa", opts) +keymap("n", "", ":w", opts) diff --git a/.config/nvim/lua/user/lsp/handlers.lua b/.config/nvim/lua/user/lsp/handlers.lua index dfddbe0..78aa651 100644 --- a/.config/nvim/lua/user/lsp/handlers.lua +++ b/.config/nvim/lua/user/lsp/handlers.lua @@ -97,16 +97,16 @@ end local function lsp_keymaps(bufnr) local opts = { noremap = true, silent = true } - vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "Telescope lsp_definitions", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "Telescope lsp_declarations", opts) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "Telescope lsp_definitions", opts) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "Telescope lsp_declarations", opts) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "lua vim.lsp.buf.hover()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gI", "Telescope lsp_implementations", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "Telescope lsp_references", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gl", "lua vim.diagnostic.open_float()", opts) - vim.cmd [[ command! Format execute 'lua vim.lsp.buf.format({ async = true })' ]] - vim.api.nvim_buf_set_keymap(bufnr, "n", "gs", "lua vim.lsp.buf.signature_help()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "", "Format", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "", "lua vim.lsp.buf.code_action()", opts) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gI", "Telescope lsp_implementations", opts) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "Telescope lsp_references", opts) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gl", "lua vim.diagnostic.open_float()", opts) + -- vim.cmd [[ command! Format execute 'lua vim.lsp.buf.format({ async = true })' ]] + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gs", "lua vim.lsp.buf.signature_help()", opts) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "", "Format", opts) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "", "lua vim.lsp.buf.code_action()", opts) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "", "lua vim.lsp.buf.signature_help()", opts) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "rn", "lua vim.lsp.buf.rename()", opts) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "ca", "lua vim.lsp.buf.code_action()", opts) @@ -118,8 +118,7 @@ end M.on_attach = function(client, bufnr) lsp_keymaps(bufnr) - -- This is currently broken, not sure why. - -- lsp_highlight_document(client) + lsp_highlight_document(client) attach_navic(client, bufnr) if client.name == "tsserver" then diff --git a/.config/nvim/lua/user/navic.lua b/.config/nvim/lua/user/navic.lua index 11fe2d6..2006322 100644 --- a/.config/nvim/lua/user/navic.lua +++ b/.config/nvim/lua/user/navic.lua @@ -1,5 +1,6 @@ local status_ok, navic = pcall(require, "nvim-navic") if not status_ok then + print("navic error!") return end @@ -8,32 +9,32 @@ local icons = require "user.icons" navic.setup { icons = { - File = ' ', - Module = ' ', - Namespace = ' ', - Package = ' ', - Class = ' ', - Method = ' ', - Property = ' ', - Field = ' ', - Constructor = ' ', - Enum = ' ', - Interface = ' ', - Function = ' ', - Variable = ' ', - Constant = ' ', - String = ' ', - Number = ' ', - Boolean = ' ', - Array = ' ', - Object = ' ', - Key = ' ', - Null = ' ', - EnumMember = ' ', - Struct = ' ', - Event = ' ', - Operator = ' ', - TypeParameter = ' ' + File = icons.kind.File, + Module = icons.kind.Module, + Namespace = icons.kind.Namespace, + Package = icons.ui.Package, + Class = icons.kind.Class, + Method = icons.kind.Method, + Property = icons.kind.Property, + Field = icons.kind.Field, + Constructor = icons.kind.Constructor, + Enum = icons.kind.Enum, + Interface = icons.kind.Interface, + Function = icons.kind.Function, + Variable = icons.kind.Variable, + Constant = icons.kind.Constant, + String = icons.type.String, + Number = icons.type.Number, + Boolean = icons.type.Boolean, + Array = icons.type.Array, + Object = icons.type.Object, + Key = icons.kind.Key, + Null = icons.type.Null, + EnumMember = icons.kind.EnumMember, + Struct = icons.kind.Struct, + Event = icons.kind.Event, + Operator = icons.kind.Operator, + TypeParameter = icons.kind.TypeParameter }, highlight = true, @@ -41,4 +42,3 @@ navic.setup { depth_limit = 0, depth_limit_indicator = "..", } - diff --git a/.config/nvim/lua/user/neoscroll.lua b/.config/nvim/lua/user/neoscroll.lua index 0edd4df..12c3209 100644 --- a/.config/nvim/lua/user/neoscroll.lua +++ b/.config/nvim/lua/user/neoscroll.lua @@ -26,8 +26,8 @@ local t = {} -- t[''] = {'scroll', { '0.10', 'false', '100'}} -- t['H'] = {'scroll', {'-0.10', 'true', '100'}} -- t['L'] = {'scroll', { '0.10', 'true', '100'}} -t[""] = { "scroll", { "-vim.wo.scroll", "true", "250" } } -t[""] = { "scroll", { "vim.wo.scroll", "true", "250" } } +-- t[""] = { "scroll", { "-vim.wo.scroll", "true", "250" } } +-- t[""] = { "scroll", { "vim.wo.scroll", "true", "250" } } -- t['zt'] = {'zt', {'250'}} -- t['zz'] = {'zz', {'250'}} -- t['zb'] = {'zb', {'250'}} diff --git a/.config/nvim/lua/user/plugins.lua b/.config/nvim/lua/user/plugins.lua index 16e97c3..88045bc 100644 --- a/.config/nvim/lua/user/plugins.lua +++ b/.config/nvim/lua/user/plugins.lua @@ -64,7 +64,7 @@ return packer.startup(function(use) use "simrat39/symbols-outline.nvim" use "b0o/SchemaStore.nvim" use "RRethy/vim-illuminate" - use "j-hui/fidget.nvim" + use "j-hui/fidget.nvim" -- displays LSP progress in bottom right use "lvimuser/lsp-inlayhints.nvim" -- use "simrat39/inlay-hints.nvim" use "https://git.sr.ht/~whynothugo/lsp_lines.nvim" @@ -88,7 +88,7 @@ return packer.startup(function(use) use "kylechui/nvim-surround" -- Marks - use "christianchiarulli/harpoon" + use "christianchiarulli/harpoon" -- mark files and navigate them through a nice ui or with keys (good for large codebases) use "MattesGroeger/vim-bookmarks" -- Fuzzy Finder/Telescope @@ -109,13 +109,14 @@ return packer.startup(function(use) -- Utility use "rcarriga/nvim-notify" - use "stevearc/dressing.nvim" + use "stevearc/dressing.nvim" -- extends the vim api for window (window dressing) use "ghillb/cybu.nvim" use "moll/vim-bbye" use "lewis6991/impatient.nvim" use "lalitmee/browse.nvim" use 'junegunn/goyo.vim' use 'junegunn/limelight.vim' + use 'folke/trouble.nvim' -- Icon use "kyazdani42/nvim-web-devicons" @@ -140,7 +141,7 @@ return packer.startup(function(use) -- File Explorer use "kyazdani42/nvim-tree.lua" - use "christianchiarulli/lir.nvim" + -- use "christianchiarulli/lir.nvim" -- Comment use "numToStr/Comment.nvim" diff --git a/.config/nvim/lua/user/toggleterm.lua b/.config/nvim/lua/user/toggleterm.lua index eb51d1f..562e61c 100644 --- a/.config/nvim/lua/user/toggleterm.lua +++ b/.config/nvim/lua/user/toggleterm.lua @@ -5,7 +5,7 @@ end toggleterm.setup { size = 20, - open_mapping = [[]], + open_mapping = [[]], hide_numbers = true, shade_filetypes = {}, shade_terminals = true, diff --git a/.config/nvim/lua/user/whichkey.lua b/.config/nvim/lua/user/whichkey.lua index ad93497..ad8e39a 100644 --- a/.config/nvim/lua/user/whichkey.lua +++ b/.config/nvim/lua/user/whichkey.lua @@ -108,7 +108,6 @@ local m_mappings = { } local mappings = { - -- ["1"] = "which_key_ignore", a = { "lua vim.lsp.buf.code_action()", "Action" }, b = { "Telescope buffers", "Buffers" }, e = { "NvimTreeToggle", "Explorer" }, @@ -118,7 +117,6 @@ local mappings = { -- h = { "nohlsearch", "No HL" }, q = { 'lua require("user.functions").smart_quit()', "Quit" }, ["/"] = { 'lua require("Comment.api").toggle.linewise.current()', "Comment" }, - -- ["c"] = { "Bdelete!", "Close Buffer" }, c = { "Bdelete!", "Close Buffer" }, -- :lua require'lir.float'.toggle() @@ -130,7 +128,6 @@ local mappings = { -- P = { "lua require('telescope').extensions.projects.projects()", "Projects" }, -- ["R"] = { 'lua require("renamer").rename()', "Rename" }, -- ["z"] = { "ZenMode", "Zen" }, - ["gy"] = "Link", B = { name = "Browse", @@ -159,26 +156,6 @@ local mappings = { l = { 'lua require("user.functions").toggle_option("cursorline")', "Cursorline" }, s = { 'lua require("user.functions").toggle_option("spell")', "Spell" }, t = { 'lua require("user.functions").toggle_tabline()', "Tabline" }, - - }, - - -- s = { - -- name = "Split", - -- s = { "split", "HSplit" }, - -- v = { "vsplit", "VSplit" }, - -- }, - - s = { - name = "Session", - s = { "SaveSession", "Save" }, - r = { "RestoreSession", "Restore" }, - x = { "DeleteSession", "Delete" }, - f = { "Autosession search", "Find" }, - d = { "Autosession delete", "Find Delete" }, - -- a = { ":SaveSession", "test" }, - -- a = { ":RestoreSession", "test" }, - -- a = { ":RestoreSessionFromFile", "test" }, - -- a = { ":DeleteSession", "test" }, }, r = { @@ -201,12 +178,6 @@ local mappings = { x = { "lua require'dap'.terminate()", "Exit" }, }, - -- nnoremap B :lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: ')) - -- nnoremap lp :lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) - -- require("dapui").open() - -- require("dapui").close() - -- require("dapui").toggle() - f = { name = "Find", b = { "Telescope git_branches", "Checkout branch" }, @@ -216,7 +187,6 @@ local mappings = { s = { "Telescope grep_string", "Find String" }, h = { "Telescope help_tags", "Help" }, H = { "Telescope highlights", "Highlights" }, - i = { "lua require('telescope').extensions.media_files.media_files()", "Media" }, l = { "Telescope resume", "Last Search" }, M = { "Telescope man_pages", "Man Pages" }, r = { "Telescope oldfiles", "Recent File" }, @@ -246,15 +216,6 @@ local mappings = { "Gitsigns diffthis HEAD", "Diff", }, - G = { - name = "Gist", - a = { "Gist -b -a", "Create Anon" }, - d = { "Gist -d", "Delete" }, - f = { "Gist -f", "Fork" }, - g = { "Gist -b", "Create" }, - l = { "Gist -l", "List" }, - p = { "Gist -b -p", "Create Private" }, - }, }, l = { @@ -295,22 +256,17 @@ local mappings = { u = { "LuaSnipUnlinkCurrent", "Unlink Snippet" }, }, - -- s = { - -- name = "Surround", - -- ["."] = { "lua require('surround').repeat_last()", "Repeat" }, - -- a = { "lua require('surround').surround_add(true)", "Add" }, - -- d = { "lua require('surround').surround_delete()", "Delete" }, - -- r = { "lua require('surround').surround_replace()", "Replace" }, - -- q = { "lua require('surround').toggle_quotes()", "Quotes" }, - -- b = { "lua require('surround').toggle_brackets()", "Brackets" }, - -- }, + s = { + name = "Surround", + ["."] = { "lua require('surround').repeat_last()", "Repeat" }, + a = { "lua require('surround').surround_add(true)", "Add" }, + d = { "lua require('surround').surround_delete()", "Delete" }, + r = { "lua require('surround').surround_replace()", "Replace" }, + q = { "lua require('surround').toggle_quotes()", "Quotes" }, + b = { "lua require('surround').toggle_brackets()", "Brackets" }, + }, S = { - -- name = "Session", - -- s = { "SaveSession", "Save" }, - -- l = { "LoadLastSession!", "Load Last" }, - -- d = { "LoadCurrentDirSession!", "Load Last Dir" }, - -- f = { "Telescope sessions save_current=false", "Find Session" }, name = "SnipRun", c = { "SnipClose", "Close" }, f = { "%SnipRun", "Run File" }, @@ -342,14 +298,6 @@ local mappings = { p = { "TSPlaygroundToggle", "Playground" }, r = { "TSToggle rainbow", "Rainbow" }, }, - - -- z = { - -- name = "Zen", - -- z = { "TZAtaraxis", "Zen" }, - -- m = { "TZMinimalist", "Minimal" }, - -- n = { "TZNarrow", "Narrow" }, - -- f = { "TZFocus", "Focus" }, - -- }, } local vopts = {