diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix index 3e60c7d..09e802f 100644 --- a/nix/neovim-overlay.nix +++ b/nix/neovim-overlay.nix @@ -59,7 +59,7 @@ with final.pkgs.lib; let lua-language-server nil phpactor - python312Packages.jedi-language-server + basedpyright #other jujutsu diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua index bb164ac..0970bca 100644 --- a/nvim/lua/plugins/lsp.lua +++ b/nvim/lua/plugins/lsp.lua @@ -4,6 +4,8 @@ return { event = 'VeryLazy', opts = { pinned = true, + focus = true, + auto_jump = true, win = { size = 0.25, position = 'right', @@ -16,6 +18,12 @@ return { 'Trouble diagnostics toggle', noremap = true, desc = 'Trouble diagnostics' + }, + { + 'nt', + 'Trouble qflist', + noremap = true, + desc = 'Trouble qflist' } } }, @@ -62,10 +70,9 @@ return { }, }, } - lspconfig.jedi_language_server.setup { capabilities = capabilities } + lspconfig.basedpyright.setup { capabilities = capabilities } lspconfig.nil_ls.setup { capabilities = capabilities } lspconfig.phpactor.setup { capabilities = capabilities } - lspconfig.ruby_lsp.setup { capabilities = capabilities } lspconfig.lua_ls.setup { capabilities = capabilities, on_init = function(client) @@ -117,6 +124,12 @@ return { 'Trouble lsp_definitions toggle win.position=left ', { buffer = ev.buf, noremap = true, silent = true, desc = 'Trouble LSP definition' } ) + vim.keymap.set( + 'n', + 'grr', + 'Trouble lsp_references toggle win.position=left ', + { buffer = ev.buf, noremap = true, silent = true, desc = 'Trouble LSP definition' } + ) vim.keymap.set( 'n', 'grl', @@ -144,7 +157,8 @@ return { 'stevearc/conform.nvim', event = 'VeryLazy', keys = { - { "\\f", function() require("conform").format({}) end, mode = { "n", "x" } }, + { "\\f", function() vim.b.disable_autoformat = not vim.b.disable_autoformat end, mode = { "n", "x" } }, + { "\\F", function() vim.g.disable_autoformat = not vim.g.disable_autoformat end, mode = { "n", "x" } }, }, opts = { notify_no_formatters = false, @@ -153,6 +167,13 @@ return { puppet = { "puppet-lint" }, ['*'] = { 'trim_whitespace' } }, + format_on_save = function(bufnr) + -- Disable with a global or buffer-local variable + if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + return + end + return { timeout_ms = 500, lsp_format = "last" } + end, default_format_opts = { timeout_ms = 500, lsp_format = "last",