diff --git a/home/apps/neovim/lazy-lock.json b/home/apps/neovim/lazy-lock.json index 5eca7bb..9e37657 100644 --- a/home/apps/neovim/lazy-lock.json +++ b/home/apps/neovim/lazy-lock.json @@ -11,7 +11,7 @@ "cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" }, - "comment.nvim": { "branch": "master", "commit": "e1fe53117aab24c378d5e6deaad786789c360123" }, + "comment.nvim": { "branch": "master", "commit": "c8043290f2d77f61025494d839d88e414608c460" }, "copilot.lua": { "branch": "master", "commit": "77e3a4907928f0813024e573b882dc879dfc0c6b" }, "diffview.nvim": { "branch": "main", "commit": "bff58a6ea3e081ca50049700f9848b2f84ea57be" }, "dressing.nvim": { "branch": "master", "commit": "f19cbd56f7f8cad212c58a7285d09c5d9c273896" }, @@ -31,12 +31,12 @@ "lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" }, "markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" }, "neodev.nvim": { "branch": "main", "commit": "358f11c585fdccfcb5e8eae720c423fbed6d92de" }, - "neogit": { "branch": "master", "commit": "80be328067b370744c39323674a2ebaf515dea14" }, + "neogit": { "branch": "master", "commit": "4cebc271b13cb7af6b5a3e8ad76a356660c0c00c" }, "null-ls.nvim": { "branch": "main", "commit": "c89333e034a8daba654ebfcf9a4ec9f87765f01e" }, "nvim-autopairs": { "branch": "master", "commit": "59df87a84c80a357ca8d8fe86e451b93ac476ccc" }, "nvim-cmp": { "branch": "main", "commit": "fc0f694af1a742ada77e5b1c91ff405c746f4a26" }, "nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" }, - "nvim-dap": { "branch": "master", "commit": "56118cee6af15cb9ddba9d080880949d8eeb0c9f" }, + "nvim-dap": { "branch": "master", "commit": "d234b0a77fc98a550dbaecdb5cd3dc5cd17147be" }, "nvim-dap-ui": { "branch": "master", "commit": "c020f660b02772f9f3d11f599fefad3268628a9e" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "57f1dbd0458dd84a286b27768c142e1567f3ce3b" }, "nvim-lspconfig": { "branch": "master", "commit": "9166622781a39a829878d1fd24c174529d996838" }, @@ -45,12 +45,12 @@ "nvim-spectre": { "branch": "master", "commit": "1abe23ec9b7bc3082164f4cb842d521ef70e080e" }, "nvim-surround": { "branch": "main", "commit": "10b20ca7d9da1ac8df8339e140ffef94f9ab3b18" }, "nvim-tree.lua": { "branch": "master", "commit": "e2a4c9d09d205ebe5f071264f43f73a0077c43a3" }, - "nvim-treesitter": { "branch": "master", "commit": "62146fe415193879290c523b54cb5072e1f5dbbc" }, + "nvim-treesitter": { "branch": "master", "commit": "56c63529c052a179134842c56c6df5728cc375da" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "95b76b95eff25e1e64f363938cd853852355d70a" }, "nvim-ts-autotag": { "branch": "main", "commit": "40615e96075c743ef47aaf9de966dc348bec6459" }, "nvim-ts-rainbow2": { "branch": "master", "commit": "5becf2cec4b8e06b6df745cf515ac35c6c2e6308" }, "nvim-web-devicons": { "branch": "master", "commit": "2a125024a137677930efcfdf720f205504c97268" }, - "octo.nvim": { "branch": "master", "commit": "95a7f271eff4397e593c90246891c18058bdffc2" }, + "octo.nvim": { "branch": "master", "commit": "0ea81c0cda4d21d054d78cd1bca7e1371df1969f" }, "playground": { "branch": "master", "commit": "2b81a018a49f8e476341dfcb228b7b808baba68b" }, "plenary.nvim": { "branch": "master", "commit": "499e0743cf5e8075cd32af68baa3946a1c76adf1" }, "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, diff --git a/home/apps/neovim/lua/lsp/init.lua b/home/apps/neovim/lua/lsp/init.lua index d737059..4de535b 100644 --- a/home/apps/neovim/lua/lsp/init.lua +++ b/home/apps/neovim/lua/lsp/init.lua @@ -115,50 +115,48 @@ cmp.setup.cmdline(":", { }), }) -local capabilities = require("cmp_nvim_lsp").default_capabilities( - vim.lsp.protocol.make_client_capabilities() -) +local capabilities = require("cmp_nvim_lsp").default_capabilities() ----@diagnostic disable-next-line: unused-local -local on_attach = function(client, bufnr) - vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") +vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("UserLspConfig", {}), + callback = function(ev) + local client = vim.lsp.get_client_by_id(ev.data.client_id) + if navic_present and client.server_capabilities.documentSymbolProvider then + navic.attach(client, ev.buf) + end - local bufopts = { noremap = true, silent = true, buffer = bufnr } - vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts) - vim.keymap.set("n", "gd", vim.lsp.buf.definition, bufopts) - vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts) - vim.keymap.set("n", "gi", vim.lsp.buf.implementation, bufopts) - vim.keymap.set("n", "wa", vim.lsp.buf.add_workspace_folder, bufopts) - vim.keymap.set( - "n", - "wr", - vim.lsp.buf.remove_workspace_folder, - bufopts - ) - vim.keymap.set("n", "wl", function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, bufopts) - vim.keymap.set("n", "D", vim.lsp.buf.type_definition, bufopts) - vim.keymap.set("n", "rn", vim.lsp.buf.rename, bufopts) - vim.keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, bufopts) - vim.keymap.set("n", "gr", vim.lsp.buf.references, bufopts) - vim.keymap.set("n", "lr", "LspRestart", bufopts) - vim.keymap.set("n", "]d", vim.diagnostic.goto_next, bufopts) - vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, bufopts) - if navic_present and client.server_capabilities.documentSymbolProvider then - navic.attach(client, bufnr) - end -end + local opts = { buffer = ev.buf } + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) + vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) + vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts) + vim.keymap.set("n", "", vim.lsp.buf.signature_help, opts) + vim.keymap.set("n", "wa", vim.lsp.buf.add_workspace_folder, opts) + vim.keymap.set("n", "wr", vim.lsp.buf.remove_workspace_folder, opts) + vim.keymap.set("n", "wl", function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, opts) + vim.keymap.set("n", "D", vim.lsp.buf.type_definition, opts) + vim.keymap.set("n", "rn", vim.lsp.buf.rename, opts) + vim.keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) + vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) + vim.keymap.set("n", "lr", "LspRestart", opts) + vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts) + vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) + vim.keymap.set("n", "fm", function() + vim.lsp.buf.format({ async = true }) + end, opts) + end, +}) lspconfig.ltex.setup({ capabilities = capabilities, - on_attach = function(client, bufnr) + on_attach = function() require("ltex_extra").setup({ load_langs = { "en-US", "de-AT" }, init_check = true, path = vim.fn.stdpath("data") .. "/dictionary", }) - on_attach(client, bufnr) end, settings = { ltex = {}, @@ -168,10 +166,7 @@ lspconfig.ltex.setup({ -- register jq for jqls vim.cmd([[au BufRead,BufNewFile *.jq setfiletype jq]]) -local common = { - capabilities = capabilities, - on_attach = on_attach, -} +local common = { capabilities = capabilities } require("lsp.go").setup(common) require("lsp.helm-ls") diff --git a/home/apps/neovim/lua/lsp/null-ls.lua b/home/apps/neovim/lua/lsp/null-ls.lua index ed95347..0fcb076 100644 --- a/home/apps/neovim/lua/lsp/null-ls.lua +++ b/home/apps/neovim/lua/lsp/null-ls.lua @@ -17,7 +17,7 @@ null.setup({ null.builtins.formatting.gofumpt, null.builtins.formatting.isort, null.builtins.formatting.prettier, - null.builtins.formatting.rustfmt, + -- null.builtins.formatting.rustfmt, null.builtins.formatting.shfmt, null.builtins.formatting.stylua, null.builtins.formatting.taplo, diff --git a/home/apps/neovim/lua/plugins/lualine.lua b/home/apps/neovim/lua/plugins/lualine.lua index d530b32..ca05404 100644 --- a/home/apps/neovim/lua/plugins/lualine.lua +++ b/home/apps/neovim/lua/plugins/lualine.lua @@ -6,7 +6,9 @@ return { "nvim-tree/nvim-web-devicons", { "SmiteshP/nvim-navic", + dependencies = { "neovim/nvim-lspconfig" }, opts = { + highlight = true, icons = { File = " ", Module = " ", @@ -40,19 +42,12 @@ return { }, config = function() local lualine = require("lualine") - local navic = require("nvim-navic") - - local config = { + lualine.setup({ options = { icons_enabled = true, - theme = "auto", + theme = "catppuccin", component_separators = { left = "", right = "" }, section_separators = { left = "", right = "" }, - disabled_filetypes = { - statusline = {}, - winbar = {}, - }, - ignore_focus = {}, always_divide_middle = true, globalstatus = true, refresh = { @@ -62,35 +57,22 @@ return { }, }, sections = { - lualine_a = { - { - "mode", - fmt = function(str) - return " " .. str - end, - }, - }, + lualine_a = { "mode" }, lualine_b = { - { "branch", icon = "" }, + "branch", "diff", "diagnostics", }, - lualine_c = { - { navic.get_location, condition = navic.is_available }, - "searchcount", - "lsp_progress", - }, - lualine_x = { "filetype" }, + lualine_c = { "searchcount" }, + lualine_x = { { "filetype", colored = false } }, lualine_y = { "progress" }, lualine_z = { "location" }, }, tabline = {}, - winbar = {}, + winbar = { lualine_c = { "navic" } }, inactive_winbar = {}, extensions = {}, - } - - lualine.setup(config) + }) end, }, }