From 6d8c04977c9defeb739a7b913fccf29b3e0cbca5 Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Tue, 5 Sep 2023 00:19:20 +0300 Subject: [PATCH] chore(nvim): plugins cleanup, updates --- config/nvim/lazy-lock.json | 8 +- config/nvim/lua/keymappings.lua | 45 +--- config/nvim/lua/lsp.lua | 4 +- config/nvim/lua/plugin-manager.lua | 26 +- config/nvim/lua/plugins/barbecue.lua | 6 +- config/nvim/lua/plugins/gitsigns.lua | 4 +- config/nvim/lua/plugins/lazy.lua | 21 -- config/nvim/lua/plugins/mini.lua | 6 +- config/nvim/lua/plugins/neo-tree.lua | 107 ++++---- config/nvim/lua/plugins/neogen.lua | 10 +- config/nvim/lua/plugins/nvim-cmp.lua | 259 -------------------- config/nvim/lua/plugins/nvim-dap.lua | 40 +-- config/nvim/lua/plugins/nvim-lspconfig.lua | 15 +- config/nvim/lua/plugins/nvim-treesitter.lua | 35 +-- config/nvim/lua/plugins/twilight.lua | 17 +- config/nvim/lua/plugins/wilder.lua | 3 +- 16 files changed, 159 insertions(+), 447 deletions(-) delete mode 100644 config/nvim/lua/plugins/nvim-cmp.lua diff --git a/config/nvim/lazy-lock.json b/config/nvim/lazy-lock.json index ee00107..bceeb84 100644 --- a/config/nvim/lazy-lock.json +++ b/config/nvim/lazy-lock.json @@ -2,7 +2,7 @@ "LuaSnip": { "branch": "master", "commit": "ea7d7ea510c641c4f15042becd27f35b3e5b3c2b" }, "barbecue.nvim": { "branch": "main", "commit": "cd7e7da622d68136e13721865b4d919efd6325ed" }, "bufdelete.nvim": { "branch": "master", "commit": "07d1f8ba79dec59d42b975a4df1c732b2e4e37b4" }, - "catppuccin": { "branch": "main", "commit": "2e3e5ebcdc24ef0d5b14a0a999dbbe7936512c46" }, + "catppuccin": { "branch": "main", "commit": "17862877792db104d48c3260aec0ace92d55f863" }, "close-buffers.nvim": { "branch": "master", "commit": "3acbcad1211572342632a6c0151f839e7dead27f" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-calc": { "branch": "main", "commit": "ce91d14d2e7a8b3f6ad86d85e34d41c1ae6268d9" }, @@ -10,13 +10,12 @@ "cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" }, "cmp-look": { "branch": "master", "commit": "b39c50bcdf6199dddda56adc466c2bd9c951a960" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, - "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "3d8912ebeb56e5ae08ef0906e3a54de1c66b92f1" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" }, "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, "comment-box.nvim": { "branch": "main", "commit": "dd1a48f8d06102e9b87ae1e0069bc365c006979b" }, - "dressing.nvim": { "branch": "master", "commit": "c7b035de7f91bb6b62b4308f105c56d1a968b8c5" }, + "dressing.nvim": { "branch": "master", "commit": "b1c7b70e1e0875243ed38f51fe7a61d08e11607e" }, "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, "friendly-snippets": { "branch": "main", "commit": "00e191fea2cfbbdd378243f35b5953296537a116" }, "gitsigns.nvim": { "branch": "main", "commit": "d927caa075df63bf301d92f874efb72fd22fd3b4" }, @@ -40,7 +39,6 @@ "nvim-navic": { "branch": "master", "commit": "9c89730da6a05acfeb6a197e212dfadf5aa60ca0" }, "nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" }, "nvim-regexplainer": { "branch": "main", "commit": "4250c8f3c1307876384e70eeedde5149249e154f" }, - "nvim-surround": { "branch": "main", "commit": "0d6882635817a2677749a330127d12ac30a4f3c8" }, "nvim-treesitter": { "branch": "master", "commit": "17b943e7c5cc2b2db3ac7b5720fbd42e75a00d8d" }, "nvim-treesitter-context": { "branch": "master", "commit": "31692b26d76ff1f7c6e0ab51814dd55e7417e96c" }, "nvim-web-devicons": { "branch": "master", "commit": "cfc8824cc1db316a276b36517f093baccb8e799a" }, @@ -50,7 +48,7 @@ "refactoring.nvim": { "branch": "master", "commit": "2ec9bc0fb5f3c8c6a0f776f0159dd2a3b1663554" }, "restoreview": { "branch": "main", "commit": "03d00d59a9ba640db6b44192ed0fcc9d7261dcd2" }, "schemastore.nvim": { "branch": "main", "commit": "a6759df4dcfc052246ee7a6cccfdb37d2180d617" }, - "smartcolumn.nvim": { "branch": "main", "commit": "4aa00ad766f3c0f0e2561e0eb42df3ea3743c135" }, + "smartcolumn.nvim": { "branch": "main", "commit": "d01b99355c7fab13233f48d0f28dc097e68a03f7" }, "stickybuf.nvim": { "branch": "master", "commit": "4c667bc837e5e3fec5a8857ee99f1a229fc76df9" }, "symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" }, "tabnine": { "branch": "master", "commit": "dcca6d2f9e8bbcde36aab87b9b87890810e4056d" }, diff --git a/config/nvim/lua/keymappings.lua b/config/nvim/lua/keymappings.lua index 5ea5752..c5fadb4 100644 --- a/config/nvim/lua/keymappings.lua +++ b/config/nvim/lua/keymappings.lua @@ -5,9 +5,7 @@ and WhichKey register. Slowly migrating to the WhichKey system, and tweaking the groupings as I go. --]] - -local key = vim.api.nvim_set_keymap -local remap = { noremap = true, silent = true } +-- luacheck: globals vim CAPABILITIES local wk = require("which-key") @@ -18,13 +16,17 @@ local wk = require("which-key") -- Register in all modes, prefix wk.register({ b = { - name = "Buffer", + name = "[b]uffer", n = { "tabnew", - "New tab", + "[n]ew tab", + }, + a = { + name = "[a]nnotate" + -- defined in plugins/neogen.lua }, c = { - name = "Comments", + name = "[c]omments", b = { "lua require('comment-box').lbox()", "Left aligned fixed size box with left aligned text", @@ -39,7 +41,7 @@ wk.register({ }, }, d = { - name = "Delete buffers", + name = "[d]elete buffers", h = { "lua require('close_buffers').delete({type = 'hidden'})", "Delete hidden buffers", @@ -165,37 +167,15 @@ wk.register({ [""] = { "", "Do just End on CTRL + End" }, }, { prefix = "" }) +local key = vim.api.nvim_set_keymap +local remap = { noremap = true, silent = true } + -- Go to the next block. --key('n', '', 'g%', remap ) -- Loop through brackets blocks. --key('n', '', 'z%', remap ) --- Highlight the word after pressing enter. -key( - "n", - "", - [[:let searchTerm = '\v<'.expand("").'>' let @/ = searchTerm echo '/'.@/ call histadd("search", searchTerm) set hls]], - remap -) - --- Highlight the visual selection after pressing enter. -key( - "v", - "", - [["*y:silent! let searchTerm = '\V'.substitute(escape(@*, '\/'), "\n", '\\n', "g") let @/ = searchTerm echo '/'.@/ call histadd("search", searchTerm) set hls]], - remap -) - --- Toggle highlight of search -key("n", "", ":set hlsearch!", remap) - --- Try to correct the current word. -key("i", "", "ea", remap) - --- Toggle built-in nvim spell checking. -key("n", "", ":setlocal spell!", remap) - -- Move lines normally like an IDE when line wraps key("i", "", [[v:count ? 'j' : 'gj']], { expr = true, noremap = true, silent = true }) key("i", "", [[v:count ? 'k' : 'gk']], { expr = true, noremap = true, silent = true }) @@ -203,7 +183,6 @@ key("n", "", [[v:count ? 'j' : 'gj']], { expr = true, noremap = true, sile key("n", "", [[v:count ? 'k' : 'gk']], { expr = true, noremap = true, silent = true }) -- Set 'CTRL + v' as 'paster' --- key('', '', 'map"_di', remap ) key("v", "", "p", remap) -- Set 'CTRL + x' as 'cut' diff --git a/config/nvim/lua/lsp.lua b/config/nvim/lua/lsp.lua index ed327f4..62ff37e 100644 --- a/config/nvim/lua/lsp.lua +++ b/config/nvim/lua/lsp.lua @@ -1,7 +1,7 @@ -- Completion for snippets. -- luacheck: globals vim CAPABILITIES +local vim = vim CAPABILITIES = vim.lsp.protocol.make_client_capabilities() -CAPABILITIES = require("cmp_nvim_lsp").default_capabilities(CAPABILITIES) CAPABILITIES.textDocument.completion.completionItem.snippetSupport = true --CAPABILITIES.offsetEncoding = 'utf-8' @@ -82,6 +82,7 @@ local servers = { jsonls = {}, lua_ls = { Lua = { + diagnostics = { globals = { "vim" } }, workspace = { checkThirdParty = false }, telemetry = { enable = false }, }, @@ -101,7 +102,6 @@ require("neodev").setup() -- nvim-cmp supports additional completion capabilities, -- so broadcast that to servers local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) -- Ensure the servers above are installed local mason_lspconfig = require("mason-lspconfig") diff --git a/config/nvim/lua/plugin-manager.lua b/config/nvim/lua/plugin-manager.lua index aafa60f..e275620 100644 --- a/config/nvim/lua/plugin-manager.lua +++ b/config/nvim/lua/plugin-manager.lua @@ -1,5 +1,6 @@ -- Package manager https://github.com/folke/lazy.nvim -- :help lazy.nvim.txt +-- luacheck: globals vim -- To install lazy.nvim automatically. local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" @@ -17,5 +18,26 @@ end vim.opt.rtp:prepend(lazypath) --- Plugins start here: -require("lazy").setup("plugins") +local options = { + defaults = { lazy = false }, + install = { colorscheme = { "catppuccin" } }, + performance = { + cache = { + enabled = true, + }, + rtp = { + disabled_plugins = { + "gzip", + "matchit", + "matchparen", + "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +} + +require("lazy").setup("plugins", options) diff --git a/config/nvim/lua/plugins/barbecue.lua b/config/nvim/lua/plugins/barbecue.lua index f82dfc4..a9d19bd 100644 --- a/config/nvim/lua/plugins/barbecue.lua +++ b/config/nvim/lua/plugins/barbecue.lua @@ -1,11 +1,13 @@ --- Winbar with context. +-- A VS Code like winbar for Neovim +-- https://github.com/utilyre/barbecue.nvim return { "utilyre/barbecue.nvim", dependencies = { "neovim/nvim-lspconfig", "SmiteshP/nvim-navic", - "kyazdani42/nvim-web-devicons", -- Optional + "kyazdani42/nvim-web-devicons", }, + version = "*", config = { theme = "catppuccin", diff --git a/config/nvim/lua/plugins/gitsigns.lua b/config/nvim/lua/plugins/gitsigns.lua index e3e31d1..b5b8d0a 100644 --- a/config/nvim/lua/plugins/gitsigns.lua +++ b/config/nvim/lua/plugins/gitsigns.lua @@ -1,4 +1,6 @@ --- Show signs of GIT written in lua +-- Git integration for buffers +-- https://github.com/lewis6991/gitsigns.nvim +-- luacheck: globals vim return { "lewis6991/gitsigns.nvim", dependencies = { "nvim-lua/plenary.nvim" }, diff --git a/config/nvim/lua/plugins/lazy.lua b/config/nvim/lua/plugins/lazy.lua index 8fdae9e..d2ac186 100644 --- a/config/nvim/lua/plugins/lazy.lua +++ b/config/nvim/lua/plugins/lazy.lua @@ -140,27 +140,6 @@ return { end, }, - -- Add/change/delete surrounding delimiter pairs with ease. - -- https://github.com/kylechui/nvim-surround - { - --[[ - Old text Command New text - ------------------------------------------------------------------ - surround_words ysiw) (surround_words) - make strings ys$" "make strings" - [delete ar*ound me!] ds] delete around me! - "change quot*es" cs'" "change quotes" - or tag* types csth1

or tag types

- delete(functi*on calls) dsf function calls - ]] - "kylechui/nvim-surround", - version = "*", -- Use for stability; omit to use `main` branch for the latest features - event = "VeryLazy", - config = function() - require("nvim-surround").setup() - end, - }, - -- A tree like view for symbols in Neovim using the LSP. -- https://github.com/simrat39/symbols-outline.nvim { diff --git a/config/nvim/lua/plugins/mini.lua b/config/nvim/lua/plugins/mini.lua index df8a858..7091ec0 100644 --- a/config/nvim/lua/plugins/mini.lua +++ b/config/nvim/lua/plugins/mini.lua @@ -50,7 +50,7 @@ return { -- Animate common Neovim actions -- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-animate.md - require("mini.animate").setup() + -- require("mini.animate").setup() -- Go forward/backward with square brackets -- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-bracketed.md @@ -120,6 +120,10 @@ return { -- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-statusline.md require("mini.statusline").setup() + -- Fast and feature-rich surround actions + -- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-surround.md + require("mini.surround").setup() + -- Minimal and fast tabline showing listed buffers -- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-tabline.md require("mini.tabline").setup() diff --git a/config/nvim/lua/plugins/neo-tree.lua b/config/nvim/lua/plugins/neo-tree.lua index ad5bb72..1d03c45 100644 --- a/config/nvim/lua/plugins/neo-tree.lua +++ b/config/nvim/lua/plugins/neo-tree.lua @@ -73,7 +73,6 @@ return { use_popups_for_input = false, -- use a custom function for sorting files and directories in the tree sort_function = nil, - event_handlers = { -- { -- event = "before_render", @@ -127,7 +126,6 @@ return { end, }, }, - default_component_configs = { container = { enable_character_fade = true, @@ -183,57 +181,6 @@ return { }, }, }, - renderers = { - directory = { - { "indent" }, - { "icon" }, - { "current_filter" }, - { - "container", - width = "100%", - right_padding = 0, - --max_width = 60, - content = { - { "name", zindex = 10 }, - -- { - -- "symlink_target", - -- zindex = 10, - -- highlight = "NeoTreeSymbolicLinkTarget", - -- }, - { "clipboard", zindex = 10 }, - { "diagnostics", errors_only = true, zindex = 20, align = "right" }, - }, - }, - }, - file = { - { "indent" }, - { "icon" }, - { - "container", - width = "100%", - right_padding = 0, - --max_width = 60, - content = { - { - "name", - use_git_status_colors = false, - zindex = 10, - }, - -- { - -- "symlink_target", - -- zindex = 10, - -- highlight = "NeoTreeSymbolicLinkTarget", - -- }, - { "clipboard", zindex = 10 }, - { "bufnr", zindex = 10 }, - -- { "harpoon_index" }, --> This is what actually adds the component in where you want it - { "modified", zindex = 20, align = "right" }, - { "diagnostics", zindex = 20, align = "right" }, - { "git_status", zindex = 20, align = "right" }, - }, - }, - }, - }, -- A list of functions, each representing a global custom command -- that will be available in all sources (if not overridden in `opts[source_name].commands`) -- see `:h neo-tree-custom-commands-global` @@ -275,10 +222,10 @@ return { [""] = "cancel", ["P"] = { "toggle_preview", config = { use_float = true } }, ["l"] = "focus_preview", - ["S"] = "open_split", - ["s"] = "open_vsplit", - -- ["S"] = "split_with_window_picker", - -- ["s"] = "vsplit_with_window_picker", + -- ["S"] = "open_split", + -- ["s"] = "open_vsplit", + ["S"] = "split_with_window_picker", + ["s"] = "vsplit_with_window_picker", ["t"] = "open_tabnew", -- [""] = "open_drop", -- ["t"] = "open_tab_drop", @@ -344,6 +291,52 @@ return { end end, }, + renderers = { + directory = { + { "indent" }, + { "icon" }, + { "current_filter" }, + { + "container", + width = "100%", + right_padding = 0, + --max_width = 60, + content = { + { "name", zindex = 10 }, + { "clipboard", zindex = 10 }, + { "diagnostics", errors_only = true, zindex = 20, align = "right" }, + }, + }, + }, + file = { + { "indent" }, + { "icon" }, + { + "container", + width = "100%", + right_padding = 0, + --max_width = 60, + content = { + { + "name", + use_git_status_colors = false, + zindex = 10, + }, + -- { + -- "symlink_target", + -- zindex = 10, + -- highlight = "NeoTreeSymbolicLinkTarget", + -- }, + { "clipboard", zindex = 10 }, + { "bufnr", zindex = 10 }, + { "harpoon_index", zindex = 20, align = "right" }, + { "modified", zindex = 20, align = "right" }, + { "diagnostics", zindex = 20, align = "right" }, + { "git_status", zindex = 20, align = "right" }, + }, + }, + }, + }, filtered_items = { -- when true, they will just be displayed differently than normal items visible = false, diff --git a/config/nvim/lua/plugins/neogen.lua b/config/nvim/lua/plugins/neogen.lua index 2ceef28..377f8fb 100644 --- a/config/nvim/lua/plugins/neogen.lua +++ b/config/nvim/lua/plugins/neogen.lua @@ -14,10 +14,10 @@ return { }, }, keys = { - { "aa", function() require("neogen").generate({ type = "current" }) end, desc = "Current" }, - { "ac", function() require("neogen").generate({ type = "class" }) end, desc = "Class" }, - { "af", function() require("neogen").generate({ type = "func" }) end, desc = "Function" }, - { "at", function() require("neogen").generate({ type = "type" }) end, desc = "Type" }, - { "aF", function() require("neogen").generate({ type = "file" }) end, desc = "File" }, + { "baa", function() require("neogen").generate({ type = "current" }) end, desc = "Current" }, + { "bac", function() require("neogen").generate({ type = "class" }) end, desc = "Class" }, + { "baf", function() require("neogen").generate({ type = "func" }) end, desc = "Function" }, + { "bat", function() require("neogen").generate({ type = "type" }) end, desc = "Type" }, + { "baF", function() require("neogen").generate({ type = "file" }) end, desc = "File" }, }, } diff --git a/config/nvim/lua/plugins/nvim-cmp.lua b/config/nvim/lua/plugins/nvim-cmp.lua deleted file mode 100644 index 35c8902..0000000 --- a/config/nvim/lua/plugins/nvim-cmp.lua +++ /dev/null @@ -1,259 +0,0 @@ --- luacheck: globals vim --- Completion menu. - --- Icons to display. -local icons = { - Text = "  ", - Method = "  ", - Function = "  ", - Constructor = "  ", - Field = " ﰠ ", - Variable = "  ", - Class = " ﴯ ", - Interface = "  ", - Module = "  ", - Property = " ﰠ ", - Unit = " 塞 ", - Value = "  ", - Enum = "  ", - Keyword = "  ", - Snippet = "  ", - Color = "  ", - File = "  ", - Reference = "  ", - Folder = "  ", - EnumMember = "  ", - Constant = "  ", - Struct = " פּ ", - Event = "  ", - Operator = "  ", - TypeParameter = " T ", - Book = "  ", -} - --- Load loaders from VSCode. ---require("luasnip.loaders.from_vscode").lazy_load({ --- paths = { "~/.local/share/lazy/friendly-snippets" } ---}) - -return { - "hrsh7th/nvim-cmp", - dependencies = { - { "octaltree/cmp-look" }, - -- - { "hrsh7th/cmp-nvim-lsp" }, - -- - { "hrsh7th/cmp-nvim-lua" }, - -- Buffer words. - { "hrsh7th/cmp-buffer" }, - -- Path autocompletion. - { "hrsh7th/cmp-path" }, - -- - { "hrsh7th/cmp-cmdline" }, - -- - { "saadparwaiz1/cmp_luasnip" }, - -- - { "hrsh7th/vim-vsnip" }, - -- - { "rafamadriz/friendly-snippets" }, - -- Snippets for lua. - { "L3MON4D3/LuaSnip" }, --config = "luasnip" }, - -- - { "hrsh7th/cmp-vsnip" }, - -- - -- Signature for functions. - --{ 'hrsh7th/cmp-nvim-lsp-signature-help' }, - -- - { "hrsh7th/vim-vsnip-integ" }, - -- Make arimathetic operations. - { "hrsh7th/cmp-calc" }, - -- Emoji. - { "hrsh7th/cmp-emoji" }, - }, - config = function() - local cmp = require("cmp") - local luasnip = require("luasnip") - require("luasnip.loaders.from_vscode").lazy_load() - luasnip.config.setup({}) - - -- Load specialities from LuaSnip. - -- Set it with VSCode-like mode. - luasnip.config.set_config({ - history = true, - updateevents = "TextChanged,TextChangedI", - }) - - cmp.setup({ - - -- Window documentation, for defining its dimensions. - window = { - -- Max 10 items on display for documentation. - max_height = 10, - completion = { - side_padding = 0, - col_offset = 1, - }, - }, - - -- Snippet support. - snippet = { - expand = function(args) require("luasnip").lsp_expand(args.body) end, - }, - - -- How the match works based on the input. - matching = { - -- Whethever we allow fuzzy matching or not. - disallow_fuzzy_matching = false, - }, - - -- Mapping each keybind. - mapping = { - [""] = cmp.mapping.select_next_item(), - [""] = cmp.mapping.select_prev_item(), - - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.close(), - [""] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }), - [""] = function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif require("luasnip").expand_or_jumpable() then - vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-expand-or-jump", true, true, true), "") - else - fallback() - end - end, - [""] = function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif require("luasnip").jumpable(-1) then - vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-jump-prev", true, true, true), "") - else - fallback() - end - end, - }, - - -- Formatting the menu display. - formatting = { - expandable_indicator = true, - fields = { "kind", "abbr", "menu" }, - format = function(_, vim_item) - vim_item.menu = vim_item.kind - - -- load lspkind icons - --vim_item.kind = string.format( - -- "%s %s", - -- icons[vim_item.kind], - -- vim_item.kind - --) - vim_item.kind = icons[vim_item.kind] - - --vim_item.menu = string.format( - -- "%s %s", - -- ({ - -- nvim_lsp = "力", - -- nvim_lua = "", - -- luasnip = icons.Color, - -- path = "﫶", - -- buffer = "﬘ ", - -- look = icons.Book, - -- emoji = "😎", - -- })[entry.source.name], - -- name - --) - - return vim_item - end, - }, - - -- Experimental features. - experimental = { - - -- It will type a shadow text of the intended completion. - ghost_text = { hl_group = "Comment" }, - }, - - -- Sources for completion, since it is modular; cmp accepts - -- Multiple modules. - sources = { - - -- Simple signature, normally outside an object. - --{ name = 'nvim_lsp_signature_help', priority = 15 }, - - -- More snippets. - -- For all types of languages. - { - name = "friendly-snippets", - priority = 11, - }, - - -- For the Nvim lua specifics commands. - { - name = "nvim_lua", - priority = 8, - }, - - -- Support with the current active LSP. - -- Anything that LSP supports and can share with CMP. - { - name = "nvim_lsp", - priority = 11, - max_item_count = 10, - }, - - -- Snippets in general to facilitate life. - -- Type a often typed methods, like for in C. - -- { name = "luasnip", priority = 6 }, - - -- Show path based on the backslashes. - -- Type any path, relatively or globally. - { - name = "path", - priority = 9, - }, - - -- Words from buffer. - { - name = "buffer", - priority = 4, - }, - - -- Max item count. - - -- Dictionary for words. - -- Type any word that is on the /usr/share/dict/words - --{ - -- name = 'look', - -- priority = 1, - -- keyword_length = 3, - -- max_item_count = 4, - -- option = { - -- convert_case = true, - -- loud = true, - -- dict = '/usr/share/dict/words' - -- }, - --}, - - -- Emoji. - -- Activate with ":". - { name = "emoji", priority = 2, option = { insert = true } }, - - -- Calculate expressions based on the current line. - -- Activate with something like "4 + 5". - { - name = "calc", - priority = 10, - }, - }, - }) - end, -} - --- The line beneath this is called `modeline`. See `:help modeline` --- vim: ts=2 sts=2 sw=2 et diff --git a/config/nvim/lua/plugins/nvim-dap.lua b/config/nvim/lua/plugins/nvim-dap.lua index 094cecf..9ba0de4 100644 --- a/config/nvim/lua/plugins/nvim-dap.lua +++ b/config/nvim/lua/plugins/nvim-dap.lua @@ -36,25 +36,38 @@ return { -- Update this to ensure that you have the debuggers for the langs you want "bash", "delve", + "jq", "js", "lua", "php", "python", + "stylua", + }, + handlers = { + function(config) + -- all sources with no handler get passed here + + -- Keep original functionality + require("mason-nvim-dap").default_setup(config) + end, }, }) - -- Basic debugging keymaps, feel free to change to your liking! - vim.keymap.set("n", "", dap.continue, { desc = "Debug: Start/Continue" }) - vim.keymap.set("n", "", dap.step_into, { desc = "Debug: Step Into" }) - vim.keymap.set("n", "", dap.step_over, { desc = "Debug: Step Over" }) - vim.keymap.set("n", "", dap.step_out, { desc = "Debug: Step Out" }) - vim.keymap.set("n", "Db", dap.toggle_breakpoint, { desc = "Debug: Toggle Breakpoint" }) - vim.keymap.set( - "n", - "DB", - function() dap.set_breakpoint(vim.fn.input("Breakpoint condition: ")) end, - { desc = "Debug: Set Breakpoint" } - ) + local wk = require("which-key") + wk.register({ + -- Basic debugging keymaps, feel free to change to your liking! + [""] = { dap.continue, "Debug: Start/Continue" }, + [""] = { dap.step_into, "Debug: Step Into" }, + [""] = { dap.step_over, "Debug: Step Over" }, + [""] = { dap.step_out, "Debug: Step Out" }, + ["Db"] = { dap.toggle_breakpoint, "Debug: Toggle Breakpoint" }, + ["DB"] = { + function() dap.set_breakpoint(vim.fn.input("Breakpoint condition: ")) end, + "Debug: Set Breakpoint", + }, + -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. + [""] = { dapui.toggle, "Debug: See last session result." }, + }, { prefix = "", mode = "n" }) -- Dap UI setup -- For more information, see |:help nvim-dap-ui| @@ -78,9 +91,6 @@ return { }, }) - -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. - vim.keymap.set("n", "", dapui.toggle, { desc = "Debug: See last session result." }) - dap.listeners.after.event_initialized["dapui_config"] = dapui.open dap.listeners.before.event_terminated["dapui_config"] = dapui.close dap.listeners.before.event_exited["dapui_config"] = dapui.close diff --git a/config/nvim/lua/plugins/nvim-lspconfig.lua b/config/nvim/lua/plugins/nvim-lspconfig.lua index a224288..a5d2d05 100644 --- a/config/nvim/lua/plugins/nvim-lspconfig.lua +++ b/config/nvim/lua/plugins/nvim-lspconfig.lua @@ -1,15 +1,18 @@ +-- Quickstart configs for Nvim LSP +-- https://github.com/neovim/nvim-lspconfig +-- luacheck: globals vim return { -- LSP auto-complete. "neovim/nvim-lspconfig", dependencies = { -- Automatically install LSPs to stdpath for neovim - { "williamboman/mason.nvim", config = true }, + { "williamboman/mason.nvim", config = true }, { "williamboman/mason-lspconfig.nvim" }, -- Useful status updates for LSP -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` -- NOTE: using tag legacy, fidget is being re-written completely - { "j-hui/fidget.nvim", event = "LspAttach", tag = "legacy", opts = {} }, + { "j-hui/fidget.nvim", event = "LspAttach", tag = "legacy", opts = {} }, -- Additional lua configuration, makes nvim stuff amazing! { "folke/neodev.nvim" }, @@ -17,9 +20,11 @@ return { init = function() -- disable lsp watcher. Too slow on linux local ok, wf = pcall(require, "vim.lsp._watchfiles") - if ok then wf._watchfunc = function() - return function() end - end end + if ok then + wf._watchfunc = function() + return function() end + end + end end, config = function() -- Switch for controlling whether you want autoformatting. diff --git a/config/nvim/lua/plugins/nvim-treesitter.lua b/config/nvim/lua/plugins/nvim-treesitter.lua index 3cc8a33..43577fa 100644 --- a/config/nvim/lua/plugins/nvim-treesitter.lua +++ b/config/nvim/lua/plugins/nvim-treesitter.lua @@ -20,38 +20,7 @@ return { modules = {}, -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { - "bash", - "c", - "cmake", - "comment", - "diff", - "dockerfile", - "gitignore", - "go", - "graphql", - "html", - "javascript", - "json", - "json5", - "latex", - "lua", - "markdown", - "php", - "phpdoc", - "python", - "regex", - "scss", - "terraform", - "todotxt", - "toml", - "tsx", - "typescript", - "vim", - "vimdoc", - "vue", - "yaml", - }, + ensure_installed = "all", highlight = { enable = true, @@ -129,5 +98,5 @@ return { enable = true, mode = "cursor", -- cursor, or topline }, - } + }, } diff --git a/config/nvim/lua/plugins/twilight.lua b/config/nvim/lua/plugins/twilight.lua index c903516..972d318 100644 --- a/config/nvim/lua/plugins/twilight.lua +++ b/config/nvim/lua/plugins/twilight.lua @@ -5,14 +5,21 @@ return { "folke/twilight.nvim", config = { dimming = { - alpha = 0.5, -- amount of dimming - inactive = false, -- when true, other windows will be fully dimmed (unless they contain the same buffer) + -- amount of dimming + alpha = 0.2, + -- when true, other windows will be fully dimmed (unless they contain the same buffer) + inactive = false, }, - context = 3, -- amount of lines we will try to show around the current line - treesitter = true, -- use treesitter when available for the filetype + -- amount of lines we will try to show around the current line + context = 3, + -- use treesitter when available for the filetype -- treesitter is used to automatically expand the visible text, -- but you can further control the types of nodes that should always be fully expanded - expand = { -- for treesitter, we we always try to expand to the top-most ancestor with these types + + treesitter = true, + + -- for treesitter, we we always try to expand to the top-most ancestor with these types + expand = { "function", "while_statement", "for_statement", diff --git a/config/nvim/lua/plugins/wilder.lua b/config/nvim/lua/plugins/wilder.lua index 390ddbf..2b6023f 100644 --- a/config/nvim/lua/plugins/wilder.lua +++ b/config/nvim/lua/plugins/wilder.lua @@ -20,8 +20,9 @@ return { wilder.set_option('renderer', wilder.popupmenu_renderer({ highlights = { - gradient = gradient, -- must be set + -- must be set -- selected_gradient key can be set to apply gradient highlighting for the selected candidate. + gradient = gradient, }, highlighter = wilder.highlighter_with_gradient({ wilder.basic_highlighter(), -- or wilder.lua_fzy_highlighter(),