Update nvim lsp and plugins

This commit is contained in:
Vladan Popovic 2025-09-26 16:41:34 +02:00
parent 5cf4792213
commit 87c31ee645
6 changed files with 29 additions and 35 deletions

View file

@ -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" }),
}

View file

@ -19,6 +19,10 @@ vim.keymap.set("n", "<leader>aa", require("actions-preview").code_actions)
-- Outline!!
vim.keymap.set("n", "<leader>o", "<cmd>Outline<CR>")
-- Close all buffers
vim.keymap.set("n", '<C-S-x>', "<cmd>bufdo bd<CR>")
vim.keymap.set("n", "<M-r>", "<cmd>lua vim.lsp.buf.rename()()<CR>")
vim.keymap.set("n", "<leader>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>")
vim.keymap.set("n", "<leader>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
vim.keymap.set("n", "<leader>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>")

View file

@ -1,15 +1,6 @@
local autoformat_files = '*.py,*.rs,*.tf'
local common_on_attach = function(client, bufnr)
-- Mappings.
vim.keymap.set("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>")
vim.keymap.set("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>")
vim.keymap.set("n", "<M-k>", "<cmd>lua vim.lsp.buf.type_definition()<CR>")
vim.keymap.set("n", "<M-r>", "<cmd>lua vim.lsp.buf.rename()()<CR>")
vim.keymap.set("n", "<leader>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>")
vim.keymap.set("n", "<leader>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
vim.keymap.set("n", "<leader>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>")
-- 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 = {}
}
},
})

View file

@ -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 },

View file

@ -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`.

View file

@ -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