diff --git a/home/.config/nvim/lazy-lock.json b/home/.config/nvim/lazy-lock.json index b872414..c800e21 100644 --- a/home/.config/nvim/lazy-lock.json +++ b/home/.config/nvim/lazy-lock.json @@ -1,8 +1,8 @@ { - "LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" }, + "LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" }, "alpha-nvim": { "branch": "main", "commit": "4b36c1ca9ea475bdc006896657cf1ccc486aeffa" }, "auto-dark-mode.nvim": { "branch": "master", "commit": "76e8d40d1e1544bae430f739d827391cbcb42fcc" }, - "bufferline.nvim": { "branch": "main", "commit": "6c456b888823d9e4832aa91c482bccd19445c009" }, + "bufferline.nvim": { "branch": "main", "commit": "d6cb9b7cac52887bcac65f8698e67479553c0748" }, "cder.nvim": { "branch": "main", "commit": "07c9e3e8324ee7c3ffde493c1612aca0be5255d0" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, @@ -16,51 +16,51 @@ "copilot-cmp": { "branch": "master", "commit": "72fbaa03695779f8349be3ac54fa8bd77eed3ee3" }, "copilot.lua": { "branch": "master", "commit": "b03617a6dc4bc88b65ab5deac1631da9a9c2dcaf" }, "diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" }, - "dropbar.nvim": { "branch": "master", "commit": "51c364728dd27f7cefe74173853e674c44efefc5" }, - "firenvim": { "branch": "master", "commit": "f2dd6d3bcf3309a7dd30c79b3b3c03ab55cea6e2" }, + "dropbar.nvim": { "branch": "master", "commit": "4516fdf6bf64f7d5719665b4d446cc49d656bd96" }, + "firenvim": { "branch": "master", "commit": "1acdf0270bdd9b83a876a15c99dca3c9b40fbaa5" }, "friendly-snippets": { "branch": "main", "commit": "aced40b66b7bae9bc2c37fd7b11841d54727a7b0" }, - "gitsigns.nvim": { "branch": "main", "commit": "300a306da9973e81c2c06460f71fd7a079df1f36" }, + "gitsigns.nvim": { "branch": "main", "commit": "6ef8c54fb526bf3a0bc4efb0b2fe8e6d9a7daed2" }, "indent-blankline.nvim": { "branch": "master", "commit": "12e92044d313c54c438bd786d11684c88f6f78cd" }, "kanagawa.nvim": { "branch": "master", "commit": "c19b9023842697ec92caf72cd3599f7dd7be4456" }, - "lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" }, - "lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" }, - "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "b9084b1f42f790d6230dc66dbcb6bcc35b148552" }, + "lazy.nvim": { "branch": "main", "commit": "28126922c9b54e35a192ac415788f202c3944c9f" }, + "lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" }, + "markdown-preview.nvim": { "branch": "master", "commit": "9becceee5740b7db6914da87358a183ad11b2049" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "56e435e09f8729af2d41973e81a0db440f8fe9c9" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "bf0f4f8062d3acbe0afcc61db01a4d19d96310e4" }, - "mason.nvim": { "branch": "main", "commit": "9c9416817c9f4e6f333c749327a1ed5355cfab61" }, + "mason.nvim": { "branch": "main", "commit": "baf99d94c3380640d19af9c70c0541bd6e7cd0cb" }, "mini.nvim": { "branch": "main", "commit": "b5645ac6eefce8e7af9d7dd4e5e296a81cba8a10" }, - "neodev.nvim": { "branch": "main", "commit": "e7ca4a2ea0da5e39a639c08c3edb352b9355f09e" }, - "neoformat": { "branch": "master", "commit": "209b56a00fc0206d81db768b121b94d0daf48b64" }, - "noice.nvim": { "branch": "main", "commit": "bf67d70bd7265d075191e7812d8eb42b9791f737" }, - "nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" }, + "neodev.nvim": { "branch": "main", "commit": "da1562e1e3df0e994ddc52cb4ba22376a5d7f2fc" }, + "neoformat": { "branch": "master", "commit": "fe6ef62dda0118a98bebb7a6c576e9b23b8a701b" }, + "noice.nvim": { "branch": "main", "commit": "92433164e2f7118d4122c7674c3834d9511722ba" }, + "nui.nvim": { "branch": "main", "commit": "9e3916e784660f55f47daa6f26053ad044db5d6a" }, "nvim-asciidoc-preview": { "branch": "main", "commit": "b1b757ccaff84fba37fb254421ffa34d3cbe3edb" }, "nvim-autopairs": { "branch": "master", "commit": "096d0baecc34f6c5d8a6dd25851e9d5ad338209b" }, - "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, + "nvim-cmp": { "branch": "main", "commit": "983453e32cb35533a119725883c04436d16c0120" }, "nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" }, - "nvim-dap": { "branch": "master", "commit": "9adbfdca13afbe646d09a8d7a86d5d031fb9c5a5" }, - "nvim-dap-ui": { "branch": "master", "commit": "d845ebd798ad1cf30aa4abd4c4eff795cdcfdd4f" }, - "nvim-jdtls": { "branch": "master", "commit": "66b5ace68a5d1c45fdfb1afa8d847e87af2aa1f8" }, - "nvim-lsp-file-operations": { "branch": "master", "commit": "4c67b566ef8bb513692c1f26637ff3356ab02f43" }, - "nvim-lspconfig": { "branch": "master", "commit": "8917d2c830e04bf944a699b8c41f097621283828" }, - "nvim-notify": { "branch": "master", "commit": "80b67b265530632505193553d05127ae7fe09ddd" }, - "nvim-tree.lua": { "branch": "master", "commit": "7bdb220d0fe604a77361e92cdbc7af1b8a412126" }, - "nvim-treesitter": { "branch": "master", "commit": "1bee80469d3d1569de47a62dd59824d9f9af0866" }, + "nvim-dap": { "branch": "master", "commit": "9d81c11fd185a131f81841e64941859305f6c42d" }, + "nvim-dap-ui": { "branch": "master", "commit": "0b4816e5ad5f3219e8e3ec9cce07f61b770c1974" }, + "nvim-jdtls": { "branch": "master", "commit": "a5c6f38f8151d7b4f5b32c005a95022fa66f4c9d" }, + "nvim-lsp-file-operations": { "branch": "master", "commit": "223aca86b737dc66e9c51ebcda8788a8d9cc6cf2" }, + "nvim-lspconfig": { "branch": "master", "commit": "cf3dd4a290084a868fac0e2e876039321d57111c" }, + "nvim-notify": { "branch": "master", "commit": "1576123bff3bed67bc673a3076e591abfe5d8ca9" }, + "nvim-tree.lua": { "branch": "master", "commit": "f1b3e6a7eb92da492bd693257367d9256839ed3d" }, + "nvim-treesitter": { "branch": "master", "commit": "f197a15b0d1e8d555263af20add51450e5aaa1f0" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "19a91a38b02c1c28c14e0ba468d20ae1423c39b2" }, - "nvim-ts-autotag": { "branch": "main", "commit": "8515e48a277a2f4947d91004d9aa92c29fdc5e18" }, - "nvim-ufo": { "branch": "main", "commit": "b0741a647efd98d9abb6cb653e056d24a07e4581" }, - "nvim-web-devicons": { "branch": "master", "commit": "b427ac5f9dff494f839e81441fb3f04a58cbcfbc" }, - "password-store": { "branch": "master", "commit": "b5e965a838bb68c1227caa2cdd874ba496f10149" }, - "plenary.nvim": { "branch": "master", "commit": "663246936325062427597964d81d30eaa42ab1e4" }, + "nvim-ts-autotag": { "branch": "main", "commit": "a65b202cfd08e0e69e531eab737205ff5bc082a4" }, + "nvim-ufo": { "branch": "main", "commit": "95a148d9b3c02facce59c2050fd20fa6e8eb2cb6" }, + "nvim-web-devicons": { "branch": "master", "commit": "a55b801b7ef5719ca25692c3a0a5447fdfb692ed" }, + "password-store": { "branch": "master", "commit": "1078f2514d579178d5df7042c6a790e9c9b731ad" }, + "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, "project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" }, - "promise-async": { "branch": "main", "commit": "94f6f03c6c1e2aab551aacdf0c1e597a7269abb6" }, + "promise-async": { "branch": "main", "commit": "38a4575da9497326badd3995e768b4ccf0bb153e" }, "statuscol.nvim": { "branch": "main", "commit": "3b629754420919575a9e5758027d6e1831dbf2aa" }, "suda.vim": { "branch": "master", "commit": "8b0fc3711760195aba104e2d190cff9af8267052" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, - "telescope.nvim": { "branch": "master", "commit": "301505da4bb72d11ffeee47ad45e0b677f70abe5" }, + "telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, "vim-asciidoctor": { "branch": "master", "commit": "f553311b5db03440eb8d7035434d0405e4a2c559" }, "vim-caddyfile": { "branch": "master", "commit": "24fe0720551883e407cb70ae1d7c03f162d1d5a0" }, - "vim-fugitive": { "branch": "master", "commit": "854a8df0d06b8d3fcb30fa7f2b08c62b553eee3b" }, - "vim-gnupg": { "branch": "main", "commit": "f9b608f29003dfde6450931dc0f495a912973a88" }, - "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } -} + "vim-fugitive": { "branch": "master", "commit": "96c1009fcf8ce60161cc938d149dd5a66d570756" }, + "vim-gnupg": { "branch": "main", "commit": "6d106fa49df3d8c1e63fac8eb64b4a0174f7e83f" }, + "which-key.nvim": { "branch": "main", "commit": "ce741eb559c924d72e3a67d2189ad3771a231414" } +} \ No newline at end of file diff --git a/home/.config/nvim/lua/lsp_utils.lua b/home/.config/nvim/lua/lsp_utils.lua index 0cc18f8..b99e501 100644 --- a/home/.config/nvim/lua/lsp_utils.lua +++ b/home/.config/nvim/lua/lsp_utils.lua @@ -2,58 +2,54 @@ -- reusable functions local m = {} +local lsp = vim.lsp +local diagnostic = vim.diagnostic + -- Maps LSP specific keybinds. -- This makes them only available when LSP is running -local function map_keys() - local telescope_builtin = require("telescope.builtin") +function m.map_keys() + local builtin = require("telescope.builtin") require("which-key").register({ g = { name = "Go to", - d = { telescope_builtin.lsp_definitions, "Definition" }, - D = { vim.lsp.buf.declaration, "Declaration" }, - t = { vim.lsp.buf.type_definition, "Type definition" }, - i = { telescope_builtin.lsp_implementations, "Implementation" }, - r = { telescope_builtin.lsp_references, "References" }, - s = { telescope_builtin.lsp_document_symbols, "Symbols" }, + d = { builtin.lsp_definitions, "Definition" }, + D = { lsp.buf.declaration, "Declaration" }, + t = { lsp.buf.type_definition, "Type definition" }, + i = { builtin.lsp_implementations, "Implementation" }, + r = { builtin.lsp_references, "References" }, + s = { builtin.lsp_document_symbols, "Symbols" }, }, [""] = { name = "Leader", w = { name = "Workspace", - a = { vim.lsp.buf.add_workspace_folder, "Add folder" }, - r = { vim.lsp.buf.remove_workspace_folder, "Remove folder" }, + a = { lsp.buf.add_workspace_folder, "Add folder" }, + r = { lsp.buf.remove_workspace_folder, "Remove folder" }, l = { function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + print(vim.inspect(lsp.buf.list_workspace_folders())) end, "List folders", }, }, - k = { vim.lsp.buf.signature_help, "Signature help" }, - rn = { vim.lsp.buf.rename, "Rename symbol" }, - ca = { vim.lsp.buf.code_action, "Code action" }, - e = { vim.diagnostic.open_float, "Open diagnostics" }, - F = { vim.lsp.buf.format, "Format with LSP" }, + k = { lsp.buf.signature_help, "Signature help" }, + rn = { lsp.buf.rename, "Rename symbol" }, + ca = { lsp.buf.code_action, "Code action" }, + e = { diagnostic.open_float, "Open diagnostics" }, + F = { lsp.buf.format, "Format with LSP" }, }, - K = { vim.lsp.buf.hover, "Hover" }, - ["["] = { d = { vim.diagnostic.goto_prev, "Previous diagnostic" } }, - ["]"] = { d = { vim.diagnostic.goto_next, "Next diagnostic" } }, + K = { lsp.buf.hover, "Hover" }, + ["["] = { d = { diagnostic.goto_prev, "Previous diagnostic" } }, + ["]"] = { d = { diagnostic.goto_next, "Next diagnostic" } }, }) end --- Maps keys and does other needed actions --- when client attaches -function m.on_attach(client, bufnr) - -- Setup keybinds - map_keys() -end - -- Combine built-in LSP and cmp cabaibilities -- and additional capabilities from other plugins function m.get_capabilities() local capabilities = vim.tbl_deep_extend( "force", - vim.lsp.protocol.make_client_capabilities(), + lsp.protocol.make_client_capabilities(), require("cmp_nvim_lsp").default_capabilities() ) diff --git a/home/.config/nvim/lua/plugins/mason.lua b/home/.config/nvim/lua/plugins/mason.lua index 618ea21..df0e181 100644 --- a/home/.config/nvim/lua/plugins/mason.lua +++ b/home/.config/nvim/lua/plugins/mason.lua @@ -11,33 +11,19 @@ return { "mfussenegger/nvim-jdtls", -- Add support for LSP file operations { "antosha417/nvim-lsp-file-operations", config = true }, - -- Neovim setup for init.lua and plugin development with full signature help, docs and completion for the nvim lua API. - { - "folke/neodev.nvim", - --- @type LuaDevOptions - opts = { - override = function(root_dir, library) - local dotfiles_path = tostring(vim.fn.expand("~/git/dotfiles")) - if string.find(root_dir, dotfiles_path, 1, true) then - library.enabled = true - library.plugins = true - end - end, - }, - }, }, config = function() require("mason").setup() - local mason_lsp = require("mason-lspconfig") + local mlspc = require("mason-lspconfig") local lsp_utils = require("lsp_utils") - mason_lsp.setup() - mason_lsp.setup_handlers({ + mlspc.setup() + mlspc.setup_handlers({ -- Default handler function(server_name) require("lspconfig")[server_name].setup({ - on_attach = lsp_utils.on_attach, + on_attach = lsp_utils.map_keys, capabilities = lsp_utils.get_capabilities(), }) end, diff --git a/home/.config/nvim/lua/plugins/neodev.lua b/home/.config/nvim/lua/plugins/neodev.lua new file mode 100644 index 0000000..4a33ca1 --- /dev/null +++ b/home/.config/nvim/lua/plugins/neodev.lua @@ -0,0 +1,14 @@ +-- Neovim setup for init.lua and plugin development with full signature help, docs and completion for the nvim lua API. +return { + "folke/neodev.nvim", + --- @type LuaDevOptions + opts = { + override = function(root_dir, library) + local dotfiles_path = tostring(vim.fn.expand("~/git/dotfiles")) + if string.find(root_dir, dotfiles_path, 1, true) then + library.enabled = true + library.plugins = true + end + end, + }, +}