neovim: overhaul plugin config and keybinds
Remove lsp-zero (replaced with native Neovim 0.11 LSP support), vim-fugitive, and pyright. Add basedpyright, gitsigns, which-key, trouble, todo-comments, indent-blankline, and telescope-fzf-native. Clean up duplicate keybinds and organize under which-key groups. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,25 +1,13 @@
|
||||
-- Plugins
|
||||
|
||||
-- LSP stuff
|
||||
local lsp_zero = require('lsp-zero')
|
||||
|
||||
|
||||
lsp_zero.on_attach(function(_, bufnr)
|
||||
lsp_zero.default_keymaps({ buffer = bufnr })
|
||||
end)
|
||||
|
||||
lsp_zero.format_on_save({
|
||||
format_opts = {
|
||||
async = false,
|
||||
timeout_ms = 10000,
|
||||
},
|
||||
servers = {
|
||||
['gopls'] = { 'go' },
|
||||
['nil_ls'] = { 'nix' },
|
||||
['lua_ls'] = { 'lua' },
|
||||
['ts_ls'] = { 'typescript', 'javascript', 'typescriptreact' },
|
||||
},
|
||||
-- Format on save for nix, lua, ts/js
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = { "*.nix", "*.lua", "*.ts", "*.tsx", "*.js" },
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ async = false, timeout_ms = 10000 })
|
||||
end,
|
||||
})
|
||||
|
||||
-- LSP: go
|
||||
vim.lsp.config("gopls", {
|
||||
settings = {
|
||||
@@ -158,14 +146,12 @@ vim.api.nvim_create_autocmd("LspAttach", {
|
||||
desc = 'LSP: Disable hover capability from Ruff',
|
||||
})
|
||||
|
||||
-- Pyright
|
||||
vim.lsp.config("pyright", {
|
||||
-- Basedpyright
|
||||
vim.lsp.config("basedpyright", {
|
||||
settings = {
|
||||
pyright = {
|
||||
basedpyright = {
|
||||
-- Using Ruff's import organizer
|
||||
disableOrganizeImports = true,
|
||||
},
|
||||
python = {
|
||||
analysis = {
|
||||
-- Ignore all files for analysis to exclusively use Ruff for linting
|
||||
ignore = { '*' },
|
||||
@@ -173,7 +159,10 @@ vim.lsp.config("pyright", {
|
||||
},
|
||||
},
|
||||
})
|
||||
vim.lsp.enable({ "pyright" })
|
||||
vim.lsp.enable({ "basedpyright" })
|
||||
|
||||
-- Gitsigns
|
||||
require('gitsigns').setup()
|
||||
|
||||
-- Telescope
|
||||
require('telescope').setup({
|
||||
@@ -186,8 +175,9 @@ require('telescope').setup({
|
||||
}
|
||||
},
|
||||
})
|
||||
require('telescope').load_extension('fzf')
|
||||
|
||||
-- Tresitter stuff
|
||||
-- Treesitter
|
||||
require('nvim-treesitter').setup {
|
||||
ensure_installed = {},
|
||||
auto_install = false,
|
||||
@@ -262,12 +252,12 @@ require('copilot_cmp').setup()
|
||||
|
||||
-- Cmp
|
||||
local cmp = require('cmp')
|
||||
local cmp_action = lsp_zero.cmp_action()
|
||||
local luasnip = require('luasnip')
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
@@ -275,9 +265,25 @@ cmp.setup({
|
||||
['<CR>'] = cmp.mapping.confirm({ select = false }),
|
||||
-- Ctrl+Space to open completion menu
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
-- Move between snippet placeholders
|
||||
['<C-f>'] = cmp_action.luasnip_jump_forward(),
|
||||
['<C-b>'] = cmp_action.luasnip_jump_backward(),
|
||||
-- Tab to select next item or jump in snippet
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
-- Scroll in completion docs
|
||||
['<C-k>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-j>'] = cmp.mapping.scroll_docs(4),
|
||||
@@ -292,6 +298,29 @@ cmp.setup({
|
||||
})
|
||||
|
||||
|
||||
-- Indent blankline
|
||||
require('ibl').setup()
|
||||
|
||||
-- Trouble
|
||||
require('trouble').setup({
|
||||
icons = false,
|
||||
})
|
||||
|
||||
-- Todo comments
|
||||
require('todo-comments').setup({
|
||||
signs = false,
|
||||
})
|
||||
|
||||
-- Which-key
|
||||
require('which-key').setup()
|
||||
require('which-key').add({
|
||||
{ "<leader>d", group = "Diagnostics" },
|
||||
{ "<leader>f", group = "Find" },
|
||||
{ "<leader>g", group = "Git" },
|
||||
{ "<leader>l", group = "LSP" },
|
||||
{ "<leader>t", group = "Tabs" },
|
||||
})
|
||||
|
||||
-- Colorscheme
|
||||
require('catppuccin').setup {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user