From 61aa9ba7ce5376a3a7cebb2289175a6cd912ad9f Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Fri, 26 Sep 2025 16:41:34 +0200 Subject: [PATCH] Update nvim lsp and plugins --- dotfiles/.config/nvim/after/lsp/ty.lua | 6 +++ dotfiles/.config/nvim/lua/keymappings.lua | 6 ++- dotfiles/.config/nvim/lua/lsp.lua | 37 ++++--------------- .../.config/nvim/lua/plugins/catppuccin.lua | 5 ++- dotfiles/.config/nvim/lua/plugins/neogit.lua | 8 ++-- dotfiles/.config/nvim/lua/plugins/oil.lua | 2 +- 6 files changed, 29 insertions(+), 35 deletions(-) create mode 100644 dotfiles/.config/nvim/after/lsp/ty.lua diff --git a/dotfiles/.config/nvim/after/lsp/ty.lua b/dotfiles/.config/nvim/after/lsp/ty.lua new file mode 100644 index 0000000..4f1df79 --- /dev/null +++ b/dotfiles/.config/nvim/after/lsp/ty.lua @@ -0,0 +1,6 @@ +-- ~/.config/nvim/after/lsp/ty.lua +return { + cmd = { "ty", "server" }, + filetypes = { "python" }, + root_dir = vim.fs.root(0, { ".git/", "pyproject.toml" }), +} diff --git a/dotfiles/.config/nvim/lua/keymappings.lua b/dotfiles/.config/nvim/lua/keymappings.lua index 58f4ca9..ab520fd 100644 --- a/dotfiles/.config/nvim/lua/keymappings.lua +++ b/dotfiles/.config/nvim/lua/keymappings.lua @@ -19,6 +19,10 @@ vim.keymap.set("n", "aa", require("actions-preview").code_actions) -- Outline!! vim.keymap.set("n", "o", "Outline") - -- Close all buffers vim.keymap.set("n", '', "bufdo bd") + +vim.keymap.set("n", "", "lua vim.lsp.buf.rename()()") +vim.keymap.set("n", "wl", "lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))") +vim.keymap.set("n", "wa", "lua vim.lsp.buf.add_workspace_folder()") +vim.keymap.set("n", "wr", "lua vim.lsp.buf.remove_workspace_folder()") diff --git a/dotfiles/.config/nvim/lua/lsp.lua b/dotfiles/.config/nvim/lua/lsp.lua index 2dde945..40b14dc 100644 --- a/dotfiles/.config/nvim/lua/lsp.lua +++ b/dotfiles/.config/nvim/lua/lsp.lua @@ -1,15 +1,6 @@ local autoformat_files = '*.py,*.rs,*.tf' local common_on_attach = function(client, bufnr) - -- Mappings. - vim.keymap.set("n", "K", "lua vim.lsp.buf.hover()") - vim.keymap.set("n", "", "lua vim.lsp.buf.signature_help()") - vim.keymap.set("n", "", "lua vim.lsp.buf.type_definition()") - vim.keymap.set("n", "", "lua vim.lsp.buf.rename()()") - vim.keymap.set("n", "wl", "lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))") - vim.keymap.set("n", "wa", "lua vim.lsp.buf.add_workspace_folder()") - vim.keymap.set("n", "wr", "lua vim.lsp.buf.remove_workspace_folder()") - -- Autoformat on save. if client.supports_method("textDocument/formatting") then vim.api.nvim_create_autocmd("BufWritePre", { @@ -19,6 +10,7 @@ local common_on_attach = function(client, bufnr) end, }) end + -- Use vim's default coloring. client.server_capabilities.semanticTokensProvider = nil for _, group in ipairs(vim.fn.getcompletion("@lsp", "highlight")) do @@ -63,9 +55,7 @@ vim.g.rustaceanvim = function() procMacro = { enable = true }, - checkOnSave = { - command = "clippy", - }, + checkOnSave = true, }, }, -- DAP configuration. @@ -75,33 +65,22 @@ vim.g.rustaceanvim = function() } end -local nvim_lsp = require('lspconfig') local capabilities = vim.lsp.protocol.make_client_capabilities() +vim.lsp.enable('ty') + -- LSPs local servers = { "clangd", "lua_ls", "ocamllsp", - "pyright", "rnix", "terraformls", "vimls", } for _, lsp in ipairs(servers) do - nvim_lsp[lsp].setup { capabilities = capabilities, on_attach = common_on_attach } + vim.lsp.config(lsp, { + capabilities = capabilities, + on_attach = common_on_attach, + }) end - -nvim_lsp.ruff.setup({ - on_attach = function (client) - common_on_attach(client) - client.server_capabilities.renameProvider = false - client.server_capabilities.hoverProvider = false - end, - init_options = { - settings = { - -- Any extra CLI arguments for `ruff` go here. - args = {} - } - }, -}) diff --git a/dotfiles/.config/nvim/lua/plugins/catppuccin.lua b/dotfiles/.config/nvim/lua/plugins/catppuccin.lua index e29ea46..3cbb45c 100644 --- a/dotfiles/.config/nvim/lua/plugins/catppuccin.lua +++ b/dotfiles/.config/nvim/lua/plugins/catppuccin.lua @@ -16,7 +16,7 @@ require("catppuccin").setup({ TelescopeNormal = { bg = "#fafafa" }, TelescopePromptNormal = { bg = colors.surface1 }, TelescopePromptBorder = { bg = colors.surface1, fg = colors.surface1 }, - CursorLine = { bg = colors.text }, + CursorLine = { bg = colors.surface2 }, NvimTreeWinSeparator = { fg = colors.text }, NvimTreeGitNew = { fg = colors.green }, NvimTreeGitDirty = { fg = colors.yellow }, @@ -100,6 +100,9 @@ require("catppuccin").setup({ DiagnosticUnnecessary = { link = "" }, + Pmenu = { fg = colors.text }, + PmenuSel = { bg = colors.overlay0 }, + --["@conceal.checked"] = { fg = colors.teal }, --["@none"] = { link = "Normal" }, --["@field"] = { fg = colors.blue }, diff --git a/dotfiles/.config/nvim/lua/plugins/neogit.lua b/dotfiles/.config/nvim/lua/plugins/neogit.lua index 771a0e6..57b7d83 100644 --- a/dotfiles/.config/nvim/lua/plugins/neogit.lua +++ b/dotfiles/.config/nvim/lua/plugins/neogit.lua @@ -24,9 +24,11 @@ neogit.setup { graph_style = "ascii", -- Used to generate URL's for branch popup action "pull request". git_services = { - ["github.com"] = "https://github.com/${owner}/${repository}/compare/${branch_name}?expand=1", - ["bitbucket.org"] = "https://bitbucket.org/${owner}/${repository}/pull-requests/new?source=${branch_name}&t=1", - ["gitlab.com"] = "https://gitlab.com/${owner}/${repository}/merge_requests/new?merge_request[source_branch]=${branch_name}", + ["github.com"] = { + pull_request = "https://github.com/${owner}/${repository}/compare/${branch_name}?expand=1", + commit = "https://github.com/${owner}/${repository}/commit/${oid}", + tree = "https://${host}/${owner}/${repository}/tree/${branch_name}", + }, }, -- Allows a different telescope sorter. Defaults to 'fuzzy_with_index_bias'. The example below will use the native fzf -- sorter instead. By default, this function returns `nil`. diff --git a/dotfiles/.config/nvim/lua/plugins/oil.lua b/dotfiles/.config/nvim/lua/plugins/oil.lua index 884e296..16e9fbb 100644 --- a/dotfiles/.config/nvim/lua/plugins/oil.lua +++ b/dotfiles/.config/nvim/lua/plugins/oil.lua @@ -53,7 +53,7 @@ require('oil').setup({ -- Skip the confirmation popup for simple operations skip_confirm_for_simple_edits = false, -- Change this to customize the command used when deleting to trash - trash_command = "trash-put", + -- trash_command = "trash-put", -- Selecting a new/moved/renamed file or directory will prompt you to save changes first prompt_save_on_select_new_entry = true, -- Keymaps in oil buffer. Can be any value that `vim.keymap.set` accepts OR a table of keymap