From 0ced314c90b8052e73a49175c7adc971597330f0 Mon Sep 17 00:00:00 2001 From: Marko Korhonen Date: Sat, 18 Nov 2023 02:27:14 +0200 Subject: [PATCH] Refactor neovim config file structure All plugins are now in their own files with their lazy specifications and configurations. Also moved lazy initialization to init.lua because it is very compact now --- home/.config/nvim/init.lua | 16 +- home/.config/nvim/lazy-lock.json | 9 +- .../lua/{plugins/lsp.lua => lsp_utils.lua} | 51 +--- home/.config/nvim/lua/plugins/asciidoc.lua | 13 + home/.config/nvim/lua/plugins/autopairs.lua | 2 + home/.config/nvim/lua/plugins/bufferline.lua | 7 + home/.config/nvim/lua/plugins/caddyfile.lua | 2 + home/.config/nvim/lua/plugins/cmp.lua | 194 +++++++------- .../nvim/lua/plugins/commentstring.lua | 5 + home/.config/nvim/lua/plugins/copilot.lua | 9 + home/.config/nvim/lua/plugins/dap.lua | 61 ++--- home/.config/nvim/lua/plugins/dashboard.lua | 12 +- home/.config/nvim/lua/plugins/emmylua.lua | 2 + home/.config/nvim/lua/plugins/firenvim.lua | 16 ++ home/.config/nvim/lua/plugins/fugitive.lua | 2 + home/.config/nvim/lua/plugins/gitsigns.lua | 15 ++ home/.config/nvim/lua/plugins/gnupg.lua | 2 + .../nvim/lua/plugins/indent-blankline.lua | 40 +-- .../plugins/{colorscheme.lua => kanagawa.lua} | 15 +- home/.config/nvim/lua/plugins/lazy.lua | 246 ------------------ home/.config/nvim/lua/plugins/lualine.lua | 11 +- home/.config/nvim/lua/plugins/luasnip.lua | 13 +- .../nvim/lua/plugins/markdown-preview.lua | 9 + home/.config/nvim/lua/plugins/mason.lua | 57 ++++ home/.config/nvim/lua/plugins/navic.lua | 2 + home/.config/nvim/lua/plugins/neoformat.lua | 10 + home/.config/nvim/lua/plugins/noice.lua | 35 ++- .../nvim/lua/plugins/nvim-colorizer.lua | 4 + home/.config/nvim/lua/plugins/nvim-tree.lua | 33 ++- home/.config/nvim/lua/plugins/redact_pass.lua | 7 + home/.config/nvim/lua/plugins/suda.lua | 2 + home/.config/nvim/lua/plugins/telescope.lua | 46 +++- home/.config/nvim/lua/plugins/treesitter.lua | 96 +++---- home/.config/nvim/lua/plugins/ufo.lua | 38 +-- .../.config/nvim/lua/plugins/vim-surround.lua | 2 + home/.config/nvim/lua/plugins/which-key.lua | 50 ++-- 36 files changed, 552 insertions(+), 582 deletions(-) rename home/.config/nvim/lua/{plugins/lsp.lua => lsp_utils.lua} (61%) create mode 100644 home/.config/nvim/lua/plugins/asciidoc.lua create mode 100644 home/.config/nvim/lua/plugins/autopairs.lua create mode 100644 home/.config/nvim/lua/plugins/bufferline.lua create mode 100644 home/.config/nvim/lua/plugins/caddyfile.lua create mode 100644 home/.config/nvim/lua/plugins/commentstring.lua create mode 100644 home/.config/nvim/lua/plugins/copilot.lua create mode 100644 home/.config/nvim/lua/plugins/emmylua.lua create mode 100644 home/.config/nvim/lua/plugins/firenvim.lua create mode 100644 home/.config/nvim/lua/plugins/fugitive.lua create mode 100644 home/.config/nvim/lua/plugins/gitsigns.lua create mode 100644 home/.config/nvim/lua/plugins/gnupg.lua rename home/.config/nvim/lua/plugins/{colorscheme.lua => kanagawa.lua} (92%) delete mode 100644 home/.config/nvim/lua/plugins/lazy.lua create mode 100644 home/.config/nvim/lua/plugins/markdown-preview.lua create mode 100644 home/.config/nvim/lua/plugins/mason.lua create mode 100644 home/.config/nvim/lua/plugins/navic.lua create mode 100644 home/.config/nvim/lua/plugins/neoformat.lua create mode 100644 home/.config/nvim/lua/plugins/nvim-colorizer.lua create mode 100644 home/.config/nvim/lua/plugins/redact_pass.lua create mode 100644 home/.config/nvim/lua/plugins/suda.lua create mode 100644 home/.config/nvim/lua/plugins/vim-surround.lua diff --git a/home/.config/nvim/init.lua b/home/.config/nvim/init.lua index 14ec44a..7d44566 100644 --- a/home/.config/nvim/init.lua +++ b/home/.config/nvim/init.lua @@ -1,4 +1,18 @@ +-- Install lazy if it's not yet installed +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + require("settings") require("neovide") require("highlight_yank") -require("plugins.lazy") +require("lazy").setup("plugins") diff --git a/home/.config/nvim/lazy-lock.json b/home/.config/nvim/lazy-lock.json index 51fed8c..49de696 100644 --- a/home/.config/nvim/lazy-lock.json +++ b/home/.config/nvim/lazy-lock.json @@ -11,7 +11,6 @@ "cmp-spell": { "branch": "master", "commit": "32a0867efa59b43edbb2db67b0871cfad90c9b66" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "copilot-cmp": { "branch": "master", "commit": "72fbaa03695779f8349be3ac54fa8bd77eed3ee3" }, - "copilot.lua": { "branch": "master", "commit": "73047082d72fcfdde1f73b7f17ad495cffcbafaa" }, "dashboard-nvim": { "branch": "master", "commit": "63df28409d940f9cac0a925df09d3dc369db9841" }, "emmylua-nvim": { "branch": "master", "commit": "50b2eead8af6499fbba708553148ee8156d6612e" }, "firenvim": { "branch": "master", "commit": "138424db463e6c0e862a05166a4ccc781cd7c19d" }, @@ -22,7 +21,7 @@ "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, "lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "faeb361507aa1ef1b0e5645781e2aa0d36a4aa84" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "ab640b38ca9fa50d25d2d249b6606b9456b628d5" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "e4f34741daa9cf95de68a603d3e7a6844a69fdf0" }, "mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" }, "neoformat": { "branch": "master", "commit": "e5fe7e8f7c3dd071b90f19af0e8c7cfa56cdedc7" }, @@ -32,13 +31,13 @@ "nvim-autopairs": { "branch": "master", "commit": "0f04d78619cce9a5af4f355968040f7d675854a1" }, "nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" }, "nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" }, - "nvim-dap": { "branch": "master", "commit": "9d81c11fd185a131f81841e64941859305f6c42d" }, + "nvim-dap": { "branch": "master", "commit": "e154fdb6d70b3765d71f296e718b29d8b7026a63" }, "nvim-jdtls": { "branch": "master", "commit": "503a399e0d0b5d432068ab5ae24b9848891b0d53" }, - "nvim-lspconfig": { "branch": "master", "commit": "29939f6f07bc0f3b9fc563fbfbee06ac88c8c439" }, + "nvim-lspconfig": { "branch": "master", "commit": "48347089666d5b77d054088aa72e4e0b58026e6e" }, "nvim-navic": { "branch": "master", "commit": "0ffa7ffe6588f3417e680439872f5049e38a24db" }, "nvim-notify": { "branch": "master", "commit": "e4a2022f4fec2d5ebc79afa612f96d8b11c627b3" }, "nvim-tree.lua": { "branch": "master", "commit": "80cfeadf179d5cba76f0f502c71dbcff1b515cd8" }, - "nvim-treesitter": { "branch": "master", "commit": "73287b794d428843f20f9ae004bef2ce67ab3dbc" }, + "nvim-treesitter": { "branch": "master", "commit": "557561fbc17269cdd4e9e88ef0ca1a9ff0bbf7e6" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "6c30f3c8915d7b31c3decdfe6c7672432da1809d" }, "nvim-web-devicons": { "branch": "master", "commit": "3523d6e6d40ab11fd66c1b2732b3d6b60affa951" }, "password-store": { "branch": "master", "commit": "28cec11f1dbe6c4273d30370af45b69c9f408386" }, diff --git a/home/.config/nvim/lua/plugins/lsp.lua b/home/.config/nvim/lua/lsp_utils.lua similarity index 61% rename from home/.config/nvim/lua/plugins/lsp.lua rename to home/.config/nvim/lua/lsp_utils.lua index 62e1487..614ac5a 100644 --- a/home/.config/nvim/lua/plugins/lsp.lua +++ b/home/.config/nvim/lua/lsp_utils.lua @@ -1,51 +1,9 @@ +-- This module contains lsp related +-- reusable functions local m = {} -function m.setup() - require("mason").setup() - local mason_lsp = require("mason-lspconfig") - mason_lsp.setup() - local capabilities = m.get_capabilities() - - mason_lsp.setup_handlers({ - -- Default handler - function(server_name) - require("lspconfig")[server_name].setup({ - on_attach = m.on_attach, - capabilities = capabilities, - }) - end, - - -- Override lua_ls settings - ["lua_ls"] = function() - require("lspconfig").lua_ls.setup({ - on_attach = m.on_attach, - capabilities = capabilities, - settings = { - Lua = { - runtime = { - -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) - version = "LuaJIT", - }, - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = { "vim" }, - }, - workspace = { - -- Make the server aware of Neovim runtime files - library = vim.api.nvim_get_runtime_file("", true), - }, - -- Do not send telemetry data containing a randomized but unique identifier - telemetry = { enable = false }, - }, - }, - }) - end, - - -- Don't set up jdtls, it is set up by nvim-jdtls - ["jdtls"] = function() end, - }) -end - +-- Map LSP specific keybinds. +-- This makes them only available when LSP is running function m.map_keys() local telescope_builtin = require("telescope.builtin") require("which-key").register({ @@ -83,6 +41,7 @@ function m.map_keys() }) end + function m.on_attach(client, bufnr) -- Attach navic if document symbols are available if client.server_capabilities.documentSymbolProvider then diff --git a/home/.config/nvim/lua/plugins/asciidoc.lua b/home/.config/nvim/lua/plugins/asciidoc.lua new file mode 100644 index 0000000..7e4a139 --- /dev/null +++ b/home/.config/nvim/lua/plugins/asciidoc.lua @@ -0,0 +1,13 @@ +-- AsciiDoc plugins are grouped together here +return { + -- Vim ♥️ Asciidoctor + { + "habamax/vim-asciidoctor", + ft = { "asciidoctor", "asciidoc" }, + }, + -- AsciiDoc preview + { + "tigion/nvim-asciidoc-preview", + ft = { "asciidoctor", "asciidoc" }, + }, +} diff --git a/home/.config/nvim/lua/plugins/autopairs.lua b/home/.config/nvim/lua/plugins/autopairs.lua new file mode 100644 index 0000000..79e2f49 --- /dev/null +++ b/home/.config/nvim/lua/plugins/autopairs.lua @@ -0,0 +1,2 @@ +-- Automatic brackets +return { "windwp/nvim-autopairs" } diff --git a/home/.config/nvim/lua/plugins/bufferline.lua b/home/.config/nvim/lua/plugins/bufferline.lua new file mode 100644 index 0000000..027fcb0 --- /dev/null +++ b/home/.config/nvim/lua/plugins/bufferline.lua @@ -0,0 +1,7 @@ +return { + "akinsho/bufferline.nvim", + version = "*", + dependencies = { "kyazdani42/nvim-web-devicons" }, + config = true, + --opts = { options = { themeable = true } }, +} diff --git a/home/.config/nvim/lua/plugins/caddyfile.lua b/home/.config/nvim/lua/plugins/caddyfile.lua new file mode 100644 index 0000000..b419a59 --- /dev/null +++ b/home/.config/nvim/lua/plugins/caddyfile.lua @@ -0,0 +1,2 @@ +-- Caddyfile syntax support +return { "isobit/vim-caddyfile", ft = "caddyfile" } diff --git a/home/.config/nvim/lua/plugins/cmp.lua b/home/.config/nvim/lua/plugins/cmp.lua index 020c371..129c4c6 100644 --- a/home/.config/nvim/lua/plugins/cmp.lua +++ b/home/.config/nvim/lua/plugins/cmp.lua @@ -1,101 +1,107 @@ -return function() - local cmp = require("cmp") - local luasnip = require("luasnip") +-- Autoompletion +return { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-buffer", -- Buffer source + { "petertriho/cmp-git", dependencies = { "nvim-lua/plenary.nvim" } }, -- Git source + "hrsh7th/cmp-nvim-lsp", -- LSP source + "hrsh7th/cmp-nvim-lua", -- Neovim Lua API documentation source + "hrsh7th/cmp-path", -- Path source + "hrsh7th/cmp-cmdline", -- cmdline source + "saadparwaiz1/cmp_luasnip", -- Snippets source + "f3fora/cmp-spell", -- Spell check source + "zbirenbaum/copilot-cmp", -- Copilot source + }, + config = function() + local cmp = require("cmp") + local luasnip = require("luasnip") - if not cmp then - return - end + if not cmp then + return + end - -- Setup git completion source - require("cmp_git").setup() - -- - -- Setup copilot source - require("copilot_cmp").setup({ fix_pairs = true }) + -- Setup git completion source + require("cmp_git").setup() + -- + -- Setup copilot source + require("copilot_cmp").setup({ fix_pairs = true }) - -- Set completeopt to have a better completion experience - vim.o.completeopt = "menuone,noselect" + -- Set completeopt to have a better completion experience + vim.o.completeopt = "menuone,noselect" - cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = { - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.select_next_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, - }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - }, - sources = { - { name = "luasnip" }, - { name = "copilot" }, - { name = "nvim_lsp" }, - { name = "nvim_lua" }, - { name = "git" }, - { name = "buffer" }, - { name = "spell" }, - { name = "path" }, - }, - -- window = { - -- completion = { - -- winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None", - -- }, - - -- documentation = { - -- winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None", - -- }, - -- }, - }) + cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = { + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_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, + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }, + sources = { + { name = "luasnip" }, + { name = "copilot" }, + { name = "nvim_lsp" }, + { name = "nvim_lua" }, + { name = "git" }, + { name = "buffer" }, + { name = "spell" }, + { name = "path" }, + }, + }) - -- Enable autopairs when enter is processed - -- on completion - local cmp_autopairs = require("nvim-autopairs.completion.cmp") - cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) + -- Enable autopairs when enter is processed + -- on completion + local cmp_autopairs = require("nvim-autopairs.completion.cmp") + cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) - -- `/` cmdline setup. - cmp.setup.cmdline("/", { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = "buffer" }, - }, - }) - -- `:` cmdline setup. - cmp.setup.cmdline(":", { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = "path" }, - }, { - { - name = "cmdline", - option = { - ignore_cmds = { "Man", "!" }, - }, + -- `/` cmdline setup. + cmp.setup.cmdline("/", { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "buffer" }, }, - }), - }) -end + }) + -- `:` cmdline setup. + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { + name = "cmdline", + option = { + ignore_cmds = { "Man", "!" }, + }, + }, + }), + }) + end, +} diff --git a/home/.config/nvim/lua/plugins/commentstring.lua b/home/.config/nvim/lua/plugins/commentstring.lua new file mode 100644 index 0000000..f5e5692 --- /dev/null +++ b/home/.config/nvim/lua/plugins/commentstring.lua @@ -0,0 +1,5 @@ +-- treesitter plugin for commentstring +return { + "JoosepAlviste/nvim-ts-context-commentstring", + dependencies = { "tpope/vim-commentary" }, +} diff --git a/home/.config/nvim/lua/plugins/copilot.lua b/home/.config/nvim/lua/plugins/copilot.lua new file mode 100644 index 0000000..16b97d1 --- /dev/null +++ b/home/.config/nvim/lua/plugins/copilot.lua @@ -0,0 +1,9 @@ +-- GitHub Copilot +return { + "zbirenbaum/copilot.lua", + config = true, + opts = { + suggestion = { enabled = false }, + panel = { enabled = false }, + }, +} diff --git a/home/.config/nvim/lua/plugins/dap.lua b/home/.config/nvim/lua/plugins/dap.lua index a279e7a..9e2fce7 100644 --- a/home/.config/nvim/lua/plugins/dap.lua +++ b/home/.config/nvim/lua/plugins/dap.lua @@ -1,31 +1,34 @@ -return function() - local dap = require("dap") +return { + "mfussenegger/nvim-dap", + config = function() + local dap = require("dap") - dap.adapters.bashdb = { - type = "executable", - command = vim.fn.stdpath("data") .. "/mason/packages/bash-debug-adapter/bash-debug-adapter", - name = "bashdb", - } + dap.adapters.bashdb = { + type = "executable", + command = vim.fn.stdpath("data") .. "/mason/packages/bash-debug-adapter/bash-debug-adapter", + name = "bashdb", + } - dap.configurations.sh = { - { - type = "bashdb", - request = "launch", - name = "Launch file", - showDebugOutput = true, - pathBashdb = vim.fn.stdpath("data") .. "/mason/packages/bash-debug-adapter/extension/bashdb_dir/bashdb", - pathBashdbLib = vim.fn.stdpath("data") .. "/mason/packages/bash-debug-adapter/extension/bashdb_dir", - trace = true, - file = "${file}", - program = "${file}", - cwd = "${workspaceFolder}", - pathCat = "cat", - pathBash = "/bin/bash", - pathMkfifo = "mkfifo", - pathPkill = "pkill", - args = {}, - env = {}, - terminalKind = "integrated", - }, - } -end + dap.configurations.sh = { + { + type = "bashdb", + request = "launch", + name = "Launch file", + showDebugOutput = true, + pathBashdb = vim.fn.stdpath("data") .. "/mason/packages/bash-debug-adapter/extension/bashdb_dir/bashdb", + pathBashdbLib = vim.fn.stdpath("data") .. "/mason/packages/bash-debug-adapter/extension/bashdb_dir", + trace = true, + file = "${file}", + program = "${file}", + cwd = "${workspaceFolder}", + pathCat = "cat", + pathBash = "/bin/bash", + pathMkfifo = "mkfifo", + pathPkill = "pkill", + args = {}, + env = {}, + terminalKind = "integrated", + }, + } + end, +} diff --git a/home/.config/nvim/lua/plugins/dashboard.lua b/home/.config/nvim/lua/plugins/dashboard.lua index 736abe9..cc52671 100644 --- a/home/.config/nvim/lua/plugins/dashboard.lua +++ b/home/.config/nvim/lua/plugins/dashboard.lua @@ -1,5 +1,9 @@ -return function() - require("dashboard").setup({ +-- Startup dashboard +return { + "glepnir/dashboard-nvim", + event = "VimEnter", + dependencies = { { "kyazdani42/nvim-web-devicons" } }, + opts = { theme = "hyper", config = { week_header = { @@ -18,5 +22,5 @@ return function() { icon = "❌ ", desc = "Quit", action = "q", key = "q" }, }, }, - }) -end + }, +} diff --git a/home/.config/nvim/lua/plugins/emmylua.lua b/home/.config/nvim/lua/plugins/emmylua.lua new file mode 100644 index 0000000..11105cf --- /dev/null +++ b/home/.config/nvim/lua/plugins/emmylua.lua @@ -0,0 +1,2 @@ +-- vim api documentation for lua lsp +return { "ii14/emmylua-nvim", ft = { "lua" } } diff --git a/home/.config/nvim/lua/plugins/firenvim.lua b/home/.config/nvim/lua/plugins/firenvim.lua new file mode 100644 index 0000000..507031e --- /dev/null +++ b/home/.config/nvim/lua/plugins/firenvim.lua @@ -0,0 +1,16 @@ +-- Neovim inside Firefox +return { + "glacambre/firenvim", + build = function() + vim.fn["firenvim#install"](0) + end, + config = function() + vim.g.firenvim_config = { + localSettings = { + [".*"] = { + takeOver = "never", + }, + }, + } + end, +} diff --git a/home/.config/nvim/lua/plugins/fugitive.lua b/home/.config/nvim/lua/plugins/fugitive.lua new file mode 100644 index 0000000..58030d2 --- /dev/null +++ b/home/.config/nvim/lua/plugins/fugitive.lua @@ -0,0 +1,2 @@ +-- Git commands +return { "tpope/vim-fugitive" } diff --git a/home/.config/nvim/lua/plugins/gitsigns.lua b/home/.config/nvim/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..7287de5 --- /dev/null +++ b/home/.config/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,15 @@ +-- Git status in signcolumn +return { + "lewis6991/gitsigns.nvim", + config = function() + local gitsigns = require("gitsigns") + gitsigns.setup() + + local wk = require("which-key") + wk.register({ + ["["] = { h = { gitsigns.prev_hunk, "Previous hunk" } }, + ["]"] = { h = { gitsigns.next_hunk, "Next hunk" } }, + }, { prefix = "" }) + + end, +} diff --git a/home/.config/nvim/lua/plugins/gnupg.lua b/home/.config/nvim/lua/plugins/gnupg.lua new file mode 100644 index 0000000..22c3b58 --- /dev/null +++ b/home/.config/nvim/lua/plugins/gnupg.lua @@ -0,0 +1,2 @@ +-- Edit GPG encrypted files transparently +return { "jamessan/vim-gnupg", ft = { "gpg" } } diff --git a/home/.config/nvim/lua/plugins/indent-blankline.lua b/home/.config/nvim/lua/plugins/indent-blankline.lua index 5d6b4c3..f5743fe 100644 --- a/home/.config/nvim/lua/plugins/indent-blankline.lua +++ b/home/.config/nvim/lua/plugins/indent-blankline.lua @@ -1,19 +1,23 @@ -return function() - require("ibl").setup({ - exclude = { - filetypes = { - "", - "checkhealth", - "dashboard", - "git", - "gitcommit", - "TelescopePrompt", - "TelescopeResults", - "help", - "lazy", - "lspinfo", - "man", +-- Indent characters +return { + "lukas-reineke/indent-blankline.nvim", + config = function() + require("ibl").setup({ + exclude = { + filetypes = { + "", + "checkhealth", + "dashboard", + "git", + "gitcommit", + "TelescopePrompt", + "TelescopeResults", + "help", + "lazy", + "lspinfo", + "man", + }, }, - }, - }) -end + }) + end, +} diff --git a/home/.config/nvim/lua/plugins/colorscheme.lua b/home/.config/nvim/lua/plugins/kanagawa.lua similarity index 92% rename from home/.config/nvim/lua/plugins/colorscheme.lua rename to home/.config/nvim/lua/plugins/kanagawa.lua index ca26060..bd7a0ab 100644 --- a/home/.config/nvim/lua/plugins/colorscheme.lua +++ b/home/.config/nvim/lua/plugins/kanagawa.lua @@ -1,5 +1,7 @@ -return function() - require("kanagawa").setup({ +-- Colorscheme +return { + "rebelot/kanagawa.nvim", + opts = { compile = true, dimInactive = true, colors = { @@ -42,7 +44,8 @@ return function() PmenuThumb = { bg = theme.ui.bg_p2 }, } end, - }) - - vim.cmd("colorscheme kanagawa") -end + }, + config = function() + vim.cmd("colorscheme kanagawa") + end, +} diff --git a/home/.config/nvim/lua/plugins/lazy.lua b/home/.config/nvim/lua/plugins/lazy.lua deleted file mode 100644 index 2199ce4..0000000 --- a/home/.config/nvim/lua/plugins/lazy.lua +++ /dev/null @@ -1,246 +0,0 @@ --- Install lazy if it's not yet installed -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release - lazypath, - }) -end -vim.opt.rtp:prepend(lazypath) - --- Configure lazy -local plugins = { - -- Colorscheme - { - "rebelot/kanagawa.nvim", - config = require("plugins.colorscheme"), - }, - - -- Replace much of neovim's default UI - -- with a modern replacement - { - "folke/noice.nvim", - event = "VeryLazy", - dependencies = { "MunifTanjim/nui.nvim", "rcarriga/nvim-notify" }, - opts = require("plugins.noice"), - }, - - -- Statusline - { - "nvim-lualine/lualine.nvim", - dependencies = { "kyazdani42/nvim-web-devicons" }, - config = require("plugins.lualine"), - }, - - -- bufferline - { - "akinsho/bufferline.nvim", - version = "v3.*", - dependencies = { "kyazdani42/nvim-web-devicons" }, - config = true, - opts = { options = { themeable = true } }, - }, - - -- Git status in signcolumn - { "lewis6991/gitsigns.nvim", config = true }, - - -- Git commands - "tpope/vim-fugitive", - - -- Indent characters - { "lukas-reineke/indent-blankline.nvim", config = require("plugins.indent-blankline") }, - - -- Tree explorer - { - "kyazdani42/nvim-tree.lua", - dependencies = { "kyazdani42/nvim-web-devicons" }, - config = require("plugins.nvim-tree"), - }, - - -- Telescope - { - "nvim-telescope/telescope.nvim", - config = require("plugins.telescope"), - dependencies = { - -- Internal dependency for telescope - "nvim-lua/plenary.nvim", - - -- Use fzf for fuzzy finder - { - "nvim-telescope/telescope-fzf-native.nvim", - build = "make", - }, - -- Replace vim built in select with telescope - "nvim-telescope/telescope-ui-select.nvim", - - -- cd plugin for telescope - "zane-/cder.nvim", - }, - }, - - -- Do stuff as sudo - "lambdalisue/suda.vim", - - -- Display possible keybinds - { "folke/which-key.nvim", config = require("plugins.which-key") }, - - -- Package manager for LSP servers, DAP adapters etc. - { - "williamboman/mason.nvim", - config = require("plugins.lsp").setup, - dependencies = { - "neovim/nvim-lspconfig", - "williamboman/mason-lspconfig.nvim", - "WhoIsSethDaniel/mason-tool-installer.nvim", - }, - }, - - -- Additional LSP features for Java - "mfussenegger/nvim-jdtls", - - -- Show code LSP context in winbar - { "SmiteshP/nvim-navic", config = true, opts = { mouse = true } }, - - -- DAP plugin - { "mfussenegger/nvim-dap", config = require("plugins.dap") }, - - -- Snippets plugin - { - "L3MON4D3/LuaSnip", - dependencies = { "rafamadriz/friendly-snippets" }, -- Snippets collection - config = require("plugins.luasnip"), - }, - - -- vim api documentation for lua lsp - { "ii14/emmylua-nvim", ft = { "lua" } }, - - -- Completion - { - "hrsh7th/nvim-cmp", - dependencies = { - "hrsh7th/cmp-buffer", -- Buffer source - { "petertriho/cmp-git", dependencies = { "nvim-lua/plenary.nvim" } }, -- Git source - "hrsh7th/cmp-nvim-lsp", -- LSP source - "hrsh7th/cmp-nvim-lua", -- Neovim Lua API documentation source - "hrsh7th/cmp-path", -- Path source - "hrsh7th/cmp-cmdline", -- cmdline source - "saadparwaiz1/cmp_luasnip", -- Snippets source - "f3fora/cmp-spell", -- Spell check source - "zbirenbaum/copilot-cmp", -- Copilot source - }, - config = require("plugins.cmp"), - }, - - -- Automatic brackets - { - "windwp/nvim-autopairs", - config = true, - }, - - -- treesitter - { - "nvim-treesitter/nvim-treesitter", - build = function() - require("nvim-treesitter.install").update({ with_sync = true }) - end, - config = require("plugins.treesitter"), - }, - - -- treesitter plugin for commentstring - "JoosepAlviste/nvim-ts-context-commentstring", - - -- mappings for commenting in code - "tpope/vim-commentary", - - -- we all know this one - "tpope/vim-surround", - - -- Formatter plugin - "sbdchd/neoformat", - - -- Make editing passwords safer - { - "https://git.zx2c4.com/password-store", - config = function(plugin) - vim.opt.rtp:append(plugin.dir .. "contrib/vim/redact_pass.vim") - end, - }, - - -- Neovim inside Firefox - { - "glacambre/firenvim", - build = function() - vim.fn["firenvim#install"](0) - end, - config = function() - vim.g.firenvim_config = { - localSettings = { - [".*"] = { - takeOver = "never", - }, - }, - } - end, - }, - - -- Vim ♥️ Asciidoctor - { "habamax/vim-asciidoctor", ft = { "asciidoctor", "asciidoc" } }, - - -- Asciidoc preview - { "tigion/nvim-asciidoc-preview", ft = { "asciidoctor", "asciidoc" } }, - - -- Markdown preview - { - "iamcco/markdown-preview.nvim", - build = "cd app && yarn install", - config = function() - vim.g.mkdp_filetypes = { "markdown" } - end, - ft = { "markdown" }, - }, - - -- Edit GPG encrypted files transparently - { "jamessan/vim-gnupg", ft = { "gpg" } }, - - -- High performance color highlighter - { - "norcalli/nvim-colorizer.lua", - config = true, - }, - - -- Caddyfile syntax support - { "isobit/vim-caddyfile", ft = "caddyfile" }, - - -- Startup dashboard - { - "glepnir/dashboard-nvim", - event = "VimEnter", - config = require("plugins.dashboard"), - dependencies = { { "kyazdani42/nvim-web-devicons" } }, - }, - - -- Better folds - { - enabled = false, - "kevinhwang91/nvim-ufo", - dependencies = { "kevinhwang91/promise-async" }, - config = require("plugins.ufo"), - }, - - -- GitHub Copilot - { - "zbirenbaum/copilot.lua", - config = function() - require("copilot").setup({ - suggestion = { enabled = false }, - panel = { enabled = false }, - }) - end, - }, -} - -require("lazy").setup(plugins, { lockfile = "~/git/dotfiles/home/.config/nvim/lazy-lock.json" }) diff --git a/home/.config/nvim/lua/plugins/lualine.lua b/home/.config/nvim/lua/plugins/lualine.lua index 5edaf3b..55759ee 100644 --- a/home/.config/nvim/lua/plugins/lualine.lua +++ b/home/.config/nvim/lua/plugins/lualine.lua @@ -1,7 +1,10 @@ -return function() - require("lualine").setup({ +-- Statusline +return { + "nvim-lualine/lualine.nvim", + dependencies = { "kyazdani42/nvim-web-devicons" }, + opts = { sections = { lualine_c = { "navic" }, }, - }) -end + }, +} diff --git a/home/.config/nvim/lua/plugins/luasnip.lua b/home/.config/nvim/lua/plugins/luasnip.lua index e89b9ac..d420c8c 100644 --- a/home/.config/nvim/lua/plugins/luasnip.lua +++ b/home/.config/nvim/lua/plugins/luasnip.lua @@ -1,4 +1,9 @@ -return function() - -- load friendly-snippets to luasnip - require("luasnip/loaders/from_vscode").lazy_load() -end +-- Snippets plugin +return { + "L3MON4D3/LuaSnip", + dependencies = { "rafamadriz/friendly-snippets" }, -- Snippets collection + config = function() + -- load friendly-snippets to luasnip + require("luasnip/loaders/from_vscode").lazy_load() + end, +} diff --git a/home/.config/nvim/lua/plugins/markdown-preview.lua b/home/.config/nvim/lua/plugins/markdown-preview.lua new file mode 100644 index 0000000..2350979 --- /dev/null +++ b/home/.config/nvim/lua/plugins/markdown-preview.lua @@ -0,0 +1,9 @@ +-- Markdown preview +return { + "iamcco/markdown-preview.nvim", + build = "cd app && yarn install", + config = function() + vim.g.mkdp_filetypes = { "markdown" } + end, + ft = { "markdown" }, +} diff --git a/home/.config/nvim/lua/plugins/mason.lua b/home/.config/nvim/lua/plugins/mason.lua new file mode 100644 index 0000000..af5dcc4 --- /dev/null +++ b/home/.config/nvim/lua/plugins/mason.lua @@ -0,0 +1,57 @@ +-- Package manager for LSP servers, DAP adapters etc. +return { + "williamboman/mason.nvim", + dependencies = { + "neovim/nvim-lspconfig", + "williamboman/mason-lspconfig.nvim", + "WhoIsSethDaniel/mason-tool-installer.nvim", + "mfussenegger/nvim-jdtls", + }, + config = function() + require("mason").setup() + + local mason_lsp = require("mason-lspconfig") + local lsp_utils = require('lsp_utils') + local capabilities = lsp_utils.get_capabilities() + mason_lsp.setup() + + mason_lsp.setup_handlers({ + -- Default handler + function(server_name) + require("lspconfig")[server_name].setup({ + on_attach = lsp_utils.on_attach, + capabilities = capabilities, + }) + end, + + -- Override lua_ls settings + ["lua_ls"] = function() + require("lspconfig").lua_ls.setup({ + on_attach = lsp_utils.on_attach, + capabilities = capabilities, + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) + version = "LuaJIT", + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = { "vim" }, + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true), + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { enable = false }, + }, + }, + }) + end, + + -- Don't set up jdtls, it is set up by nvim-jdtls + ["jdtls"] = function() end, + }) + end, +} diff --git a/home/.config/nvim/lua/plugins/navic.lua b/home/.config/nvim/lua/plugins/navic.lua new file mode 100644 index 0000000..de3d7dc --- /dev/null +++ b/home/.config/nvim/lua/plugins/navic.lua @@ -0,0 +1,2 @@ +-- Show code LSP context in winbar +return { "SmiteshP/nvim-navic" } diff --git a/home/.config/nvim/lua/plugins/neoformat.lua b/home/.config/nvim/lua/plugins/neoformat.lua new file mode 100644 index 0000000..2abef6e --- /dev/null +++ b/home/.config/nvim/lua/plugins/neoformat.lua @@ -0,0 +1,10 @@ +-- Formatter plugin +return { + "sbdchd/neoformat", + config = function() + local wk = require("which-key") + wk.register({ + f = { "Neoformat", "Format with Neoformat" }, + }, { prefix = "" }) + end, +} diff --git a/home/.config/nvim/lua/plugins/noice.lua b/home/.config/nvim/lua/plugins/noice.lua index 83cb3d9..01fb80c 100644 --- a/home/.config/nvim/lua/plugins/noice.lua +++ b/home/.config/nvim/lua/plugins/noice.lua @@ -1,18 +1,25 @@ +-- Replace much of neovim's default UI +-- with a modern replacement return { - lsp = { - -- override markdown rendering so that **cmp** and other plugins use **Treesitter** - override = { - ["vim.lsp.util.convert_input_to_markdown_lines"] = true, - ["vim.lsp.util.stylize_markdown"] = true, - ["cmp.entry.get_documentation"] = true, + "folke/noice.nvim", + event = "VeryLazy", + dependencies = { "MunifTanjim/nui.nvim", "rcarriga/nvim-notify" }, + opts = { + lsp = { + -- override markdown rendering so that **cmp** and other plugins use **Treesitter** + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + ["cmp.entry.get_documentation"] = true, + }, + }, + -- you can enable a preset for easier configuration + presets = { + bottom_search = true, -- use a classic bottom cmdline for search + command_palette = true, -- position the cmdline and popupmenu together + long_message_to_split = true, -- long messages will be sent to a split + inc_rename = false, -- enables an input dialog for inc-rename.nvim + lsp_doc_border = false, -- add a border to hover docs and signature help }, - }, - -- you can enable a preset for easier configuration - presets = { - bottom_search = true, -- use a classic bottom cmdline for search - command_palette = true, -- position the cmdline and popupmenu together - long_message_to_split = true, -- long messages will be sent to a split - inc_rename = false, -- enables an input dialog for inc-rename.nvim - lsp_doc_border = false, -- add a border to hover docs and signature help }, } diff --git a/home/.config/nvim/lua/plugins/nvim-colorizer.lua b/home/.config/nvim/lua/plugins/nvim-colorizer.lua new file mode 100644 index 0000000..089885d --- /dev/null +++ b/home/.config/nvim/lua/plugins/nvim-colorizer.lua @@ -0,0 +1,4 @@ +-- High performance color highlighter +return { + "norcalli/nvim-colorizer.lua", +} diff --git a/home/.config/nvim/lua/plugins/nvim-tree.lua b/home/.config/nvim/lua/plugins/nvim-tree.lua index 7f86f96..b15b0f0 100644 --- a/home/.config/nvim/lua/plugins/nvim-tree.lua +++ b/home/.config/nvim/lua/plugins/nvim-tree.lua @@ -1,13 +1,20 @@ -return function() - require("nvim-tree").setup({ -- BEGIN_DEFAULT_OPTS - diagnostics = { - enable = true, - show_on_dirs = true, - }, - renderer = { - highlight_git = true, - }, - }) - -- Open/close with alt-o - vim.keymap.set("n", "", vim.cmd.NvimTreeToggle) -end +-- Tree explorer +return { + "kyazdani42/nvim-tree.lua", + dependencies = { "kyazdani42/nvim-web-devicons" }, + opts = { + diagnostics = { + enable = true, + show_on_dirs = true, + }, + renderer = { + highlight_git = true, + }, + }, + config = function(spec) + require("nvim-tree").setup(spec.opts) + + -- Open/close with alt-o + vim.keymap.set("n", "", vim.cmd.NvimTreeToggle) + end, +} diff --git a/home/.config/nvim/lua/plugins/redact_pass.lua b/home/.config/nvim/lua/plugins/redact_pass.lua new file mode 100644 index 0000000..3ac5d31 --- /dev/null +++ b/home/.config/nvim/lua/plugins/redact_pass.lua @@ -0,0 +1,7 @@ +-- Make editing passwords safer +return { + "https://git.zx2c4.com/password-store", + config = function(plugin) + vim.opt.rtp:append(plugin.dir .. "contrib/vim/redact_pass.vim") + end, +} diff --git a/home/.config/nvim/lua/plugins/suda.lua b/home/.config/nvim/lua/plugins/suda.lua new file mode 100644 index 0000000..cb7a4b5 --- /dev/null +++ b/home/.config/nvim/lua/plugins/suda.lua @@ -0,0 +1,2 @@ +-- Do stuff as sudo +return { "lambdalisue/suda.vim" } diff --git a/home/.config/nvim/lua/plugins/telescope.lua b/home/.config/nvim/lua/plugins/telescope.lua index 5a30c1a..c2414c6 100644 --- a/home/.config/nvim/lua/plugins/telescope.lua +++ b/home/.config/nvim/lua/plugins/telescope.lua @@ -1,8 +1,22 @@ -return function() - local telescope = require("telescope") - local builtin = require("telescope.builtin") +return { + "nvim-telescope/telescope.nvim", + dependencies = { + -- Internal dependency for telescope + "nvim-lua/plenary.nvim", - telescope.setup({ + -- Use fzf for fuzzy finder + { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + }, + + -- Replace vim built in select with telescope + "nvim-telescope/telescope-ui-select.nvim", + + -- cd plugin for telescope + "zane-/cder.nvim", + }, + opts = { pickers = { find_files = { find_command = { "fd", "-Ht", "f" } }, lsp_references = { show_line = false }, @@ -30,14 +44,20 @@ return function() dir_command = { "fd", "-Ht", "d", ".", os.getenv("HOME") }, }, }, - }) + }, + config = function(spec) + local telescope = require("telescope") + local builtin = require("telescope.builtin") + + telescope.setup(spec.opts) - telescope.load_extension("fzf") - telescope.load_extension("ui-select") - telescope.load_extension("cder") + telescope.load_extension("fzf") + telescope.load_extension("ui-select") + telescope.load_extension("cder") - -- Keybinds - vim.keymap.set("n", "", vim.cmd.Telescope) - vim.keymap.set("n", "", builtin.find_files) - vim.keymap.set("n", "", builtin.live_grep) -end + -- Keybinds + vim.keymap.set("n", "", vim.cmd.Telescope) + vim.keymap.set("n", "", builtin.find_files) + vim.keymap.set("n", "", builtin.live_grep) + end, +} diff --git a/home/.config/nvim/lua/plugins/treesitter.lua b/home/.config/nvim/lua/plugins/treesitter.lua index ca53a23..f181aea 100644 --- a/home/.config/nvim/lua/plugins/treesitter.lua +++ b/home/.config/nvim/lua/plugins/treesitter.lua @@ -1,46 +1,52 @@ -return function() - require("nvim-treesitter.configs").setup({ - ensure_installed = { - "bash", - "css", - "dockerfile", - "git_config", - "git_rebase", - "gitattributes", - "gitcommit", - "gitignore", - "html", - "http", - "java", - "javascript", - "json", - "json5", - "latex", - "lua", - "make", - "markdown", - "markdown_inline", - "php", - "python", - "rasi", - "regex", - "rst", - "scss", - "toml", - "tsx", - "typescript", - "vim", - "yaml", - }, - highlight = { enable = true }, - indent = { enable = true }, - incremental_selection = { enable = true }, - context_commentstring = { enable = true }, - sync_install = true, - ignore_install = {}, - auto_install = true, - }) +return { + "nvim-treesitter/nvim-treesitter", + build = function() + require("nvim-treesitter.install").update({ with_sync = true }) + end, + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = { + "bash", + "css", + "dockerfile", + "git_config", + "git_rebase", + "gitattributes", + "gitcommit", + "gitignore", + "html", + "http", + "java", + "javascript", + "json", + "json5", + "latex", + "lua", + "make", + "markdown", + "markdown_inline", + "php", + "python", + "rasi", + "regex", + "rst", + "scss", + "toml", + "tsx", + "typescript", + "vim", + "yaml", + }, + highlight = { enable = true }, + indent = { enable = true }, + incremental_selection = { enable = true }, + context_commentstring = { enable = true }, + sync_install = true, + ignore_install = {}, + auto_install = true, + }) - -- vim.wo.foldmethod = 'expr' - -- im.wo.foldexpr = 'nvim_treesitter#foldexpr()' -end + -- vim.wo.foldmethod = 'expr' + -- im.wo.foldexpr = 'nvim_treesitter#foldexpr()' + end, +} diff --git a/home/.config/nvim/lua/plugins/ufo.lua b/home/.config/nvim/lua/plugins/ufo.lua index d758224..13c8253 100644 --- a/home/.config/nvim/lua/plugins/ufo.lua +++ b/home/.config/nvim/lua/plugins/ufo.lua @@ -1,20 +1,28 @@ -return function() - local keymap = vim.keymap - local o = vim.o - local ufo = require("ufo") - ufo.setup({ +-- Better folds +-- Disabled for now because it causes weird artifacts +return { + enabled = false, + "kevinhwang91/nvim-ufo", + dependencies = { "kevinhwang91/promise-async" }, + opts = { close_fold_kinds = { "imports", }, - }) + }, + config = function(spec) + local ufo = require("ufo") + ufo.setup(spec.opts) - -- Using ufo, need to remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself - keymap.set("n", "zR", ufo.openAllFolds) - keymap.set("n", "zM", ufo.closeAllFolds) + -- Using ufo, need to remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself + local keymap = vim.keymap + keymap.set("n", "zR", ufo.openAllFolds) + keymap.set("n", "zM", ufo.closeAllFolds) - -- Fold settings - o.foldcolumn = "1" - o.foldlevel = 99 - o.foldlevelstart = 99 - o.foldenable = true -end + -- Fold settings + local o = vim.o + o.foldcolumn = "1" + o.foldlevel = 99 + o.foldlevelstart = 99 + o.foldenable = true + end, +} diff --git a/home/.config/nvim/lua/plugins/vim-surround.lua b/home/.config/nvim/lua/plugins/vim-surround.lua new file mode 100644 index 0000000..904b9c8 --- /dev/null +++ b/home/.config/nvim/lua/plugins/vim-surround.lua @@ -0,0 +1,2 @@ +-- we all know this one +return { "tpope/vim-surround" } diff --git a/home/.config/nvim/lua/plugins/which-key.lua b/home/.config/nvim/lua/plugins/which-key.lua index 7c1cbf8..e85e51a 100644 --- a/home/.config/nvim/lua/plugins/which-key.lua +++ b/home/.config/nvim/lua/plugins/which-key.lua @@ -1,29 +1,29 @@ -return function() - local wk = require("which-key") - local gitsigns = require("gitsigns") - wk.setup({}) +-- Display possible keybinds +-- Plugin specific keybinds are set up in plugin configuration file +return { + "folke/which-key.nvim", + config = function() + local wk = require("which-key") + wk.setup({}) - wk.register({ - f = { "Neoformat", "Format with Neoformat" }, - h = { "nohlsearch", "Turn off search highlight" }, - }, { prefix = "" }) + wk.register({ + h = { "nohlsearch", "Turn off search highlight" }, + }, { prefix = "" }) - wk.register({ - [""] = { "bnext", "Next buffer" }, - [""] = { "bprevious", "Previous buffer" }, - ["["] = { h = { gitsigns.prev_hunk, "Previous hunk" } }, - ["]"] = { h = { gitsigns.next_hunk, "Next hunk" } }, - }) + wk.register({ + [""] = { "bnext", "Next buffer" }, + [""] = { "bprevious", "Previous buffer" }, + }) - -- Open cder - wk.register({ cd = { - function() - vim.cmd("Telescope cder") - end, - "Change directories", - } }) + -- Open cder + wk.register({ cd = { + function() + vim.cmd("Telescope cder") + end, + "Change directories", + } }) - -- Exit terminal insert mode with esc - vim.keymap.set("t", "", "", {}) - -end + -- Exit terminal insert mode with esc + vim.keymap.set("t", "", "", {}) + end, +}