feat: update nvim config to match 0.12 version

This commit is contained in:
2026-04-13 23:53:34 +02:00
parent 9f62daedcd
commit e5300b3686
18 changed files with 176 additions and 317 deletions

View File

@@ -1,28 +1,18 @@
{
"LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" },
"catppuccin": { "branch": "main", "commit": "a7788416689dbefea659d9e9415c87926b0ba5d8" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" },
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"copilot.lua": { "branch": "master", "commit": "538f15c4eaad8661389a4a0d1ace2d6e079fac29" },
"fidget.nvim": { "branch": "main", "commit": "7fa433a83118a70fe24c1ce88d5f0bd3453c0970" },
"friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
"git-worktree.nvim": { "branch": "master", "commit": "f247308e68dab9f1133759b05d944569ad054546" },
"LuaSnip": { "branch": "master", "commit": "642b0c595e11608b4c18219e93b88d7637af27bc" },
"catppuccin": { "branch": "main", "commit": "426dbebe06b5c69fd846ceb17b42e12f890aedf1" },
"copilot.lua": { "branch": "master", "commit": "ad7e729e9a6348f7da482be0271d452dbc4c8e2c" },
"harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" },
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "38499e0bda64bc0f3ec6e7f03f8e13dd11c0fa00" },
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
"nvim-cmp": { "branch": "main", "commit": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca" },
"nvim-lspconfig": { "branch": "master", "commit": "d93772c34327e6a8cf72e5a7d95234ce6c36cd19" },
"nvim-treesitter": { "branch": "master", "commit": "cf12346a3414fa1b06af75c79faebe7f76df080a" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"smart-splits.nvim": { "branch": "master", "commit": "96afd5d3b029ac354aaa369fb33b4613a0bbf2f0" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "0a3b42c3e503df87aef6d6513e13148381495c3a" },
"mason.nvim": { "branch": "main", "commit": "b03fb0f20bc1d43daf558cda981a2be22e73ac42" },
"nvim-lspconfig": { "branch": "master", "commit": "8a9378a822719346a0288fa004dab302ca3c0a8f" },
"plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" },
"smart-splits.nvim": { "branch": "master", "commit": "09796a7ad0776c92518e0afae8688ef8d7f720e6" },
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
"tree-sitter-manager.nvim": { "branch": "main", "commit": "fa63bc63ae08b661843d9976a43becfbd3daf76c" },
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" },
"undotree": { "branch": "master", "commit": "6fa6b57cda8459e1e4b2ca34df702f55242f4e4d" },
"vim-fugitive": { "branch": "master", "commit": "3b753cf8c6a4dcde6edee8827d464ba9b8c4a6f0" },
"vim-tmux-navigator": { "branch": "master", "commit": "c45243dc1f32ac6bcf6068e5300f3b2b237e576a" },
"vimwiki": { "branch": "dev", "commit": "72792615e739d0eb54a9c8f7e0a46a6e2407c9e8" }
}

View File

@@ -1,6 +0,0 @@
local cmp_lsp = require("cmp_nvim_lsp")
local capabilities = cmp_lsp.default_capabilities()
vim.lsp.config('clangd', {
capabilities = capabilities,
})

View File

@@ -1,6 +0,0 @@
local cmp_lsp = require("cmp_nvim_lsp")
local capabilities = cmp_lsp.default_capabilities()
vim.lsp.config('eslint', {
capabilities = capabilities,
})

View File

@@ -1,13 +0,0 @@
local cmp_lsp = require("cmp_nvim_lsp")
local capabilities = cmp_lsp.default_capabilities()
vim.lsp.config('lua_ls', {
capabilities = capabilities,
settings = {
Lua = {
diagnostics = {
globals = { "vim" }
}
}
}
})

View File

@@ -1,6 +0,0 @@
local cmp_lsp = require("cmp_nvim_lsp")
local capabilities = cmp_lsp.default_capabilities()
vim.lsp.config('pylsp', {
capabilities = capabilities,
})

View File

@@ -1,6 +0,0 @@
local cmp_lsp = require("cmp_nvim_lsp")
local capabilities = cmp_lsp.default_capabilities()
vim.lsp.config('rust_analyzer', {
capabilities = capabilities,
})

View File

@@ -1,6 +0,0 @@
local cmp_lsp = require("cmp_nvim_lsp")
local capabilities = cmp_lsp.default_capabilities()
vim.lsp.config('ts_ls', {
capabilities = capabilities,
})

View File

@@ -27,3 +27,9 @@ vim.opt.isfname:append("@-@")
vim.opt.updatetime = 50
vim.opt.colorcolumn = "80"
-- Autocomplete menu settings
vim.opt.completeopt = { "menuone", "noselect", "popup" }
vim.opt.autocomplete = true
vim.opt.complete = "o" -- Include only omnifunc results
vim.opt.pumheight = 5

View File

@@ -1,7 +1,8 @@
return {
{ 'tpope/vim-fugitive',
config = function ()
vim.keymap.set("n", "<leader>gs", vim.cmd.Git);
end
}
keys = {
{ "<leader>gs", vim.cmd.Git, desc = "Open Vim Fugitive" },
},
dependencies = { "nvim-lua/plenary.nvim" }
},
}

View File

@@ -1,28 +0,0 @@
return {
{
"ThePrimeagen/git-worktree.nvim",
opt = {},
config = function()
require("telescope").load_extension("git_worktree")
end,
keys = {
{
"<leader>gw",
function()
require("telescope").extensions.git_worktree.git_worktrees()
end,
desc = "Git Worktree switch",
},
{
"<leader>gn",
function()
require("telescope").extensions.git_worktree.create_git_worktree()
end,
desc = "Git Worktree create",
},
},
dependencies = {
"nvim-telescope/telescope.nvim",
}
}
}

View File

@@ -1,152 +1,115 @@
return {
{
'neovim/nvim-lspconfig',
keys = {
{ "<space>e", vim.diagnostic.open_float, mode = "n", desc = "Open diagnostic float" },
{ "[d", vim.diagnostic.goto_prev, mode = "n", desc = "Go to previous diagnostic" },
{ "]d", vim.diagnostic.goto_next, mode = "n", desc = "Go to next diagnostic" },
{ "<space>q", vim.diagnostic.setloclist, mode = "n", desc = "Set location list with diagnostics" },
},
config = function()
-- Use LspAttach autocommand to only map the following keys
-- after the language server attaches to the current buffer
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
callback = function(ev)
-- Buffer local mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
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('i', '<C-k>', vim.lsp.buf.signature_help, opts)
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
vim.keymap.set('n', '<space>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, opts)
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
vim.keymap.set({ 'n', 'v' }, '<leader>ca', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', '<leader>f', function()
vim.lsp.buf.format { async = true }
end, opts)
end,
})
{
'neovim/nvim-lspconfig',
dependencies = {
{ 'williamboman/mason.nvim', opts = {} },
'williamboman/mason-lspconfig.nvim',
},
config = function()
vim.diagnostic.config({ float = { border = 'rounded' }, virtual_text = false })
-- Set up diagnostics
vim.diagnostic.config({
float = {
focusable = false,
style = 'minimal',
border = 'rounded',
source = 'always',
header = '',
prefix = '',
}
})
-- Define Servers
local servers = {
lua_ls = {
settings = {
Lua = {
diagnostics = {
-- Recognize the `vim` global variable
globals = { "vim" }
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
checkThirdParty = false,
},
telemetry = {
enable = false,
},
}
}
},
pylsp = {},
ts_ls = {},
rust_analyzer = {},
eslint = {},
clangd = {},
}
-- Set up cmp
local cmp = require('cmp')
local cmp_select_behavior = { behavior = cmp.SelectBehavior.Select }
-- Prepare Native Capabilities
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
cmp.setup({
preselect = cmp.PreselectMode.None,
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
end,
},
mapping = cmp.mapping.preset.insert({
-- `Enter` key to confirm completion
['<CR>'] = cmp.mapping({
i = function(fallback)
if cmp.visible() and cmp.get_active_entry() then
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
else
fallback()
end
end,
s = cmp.mapping.confirm({ select = true }),
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
}),
-- Alt+Space to trigger completion menu
['<M-Space>'] = cmp.mapping.complete(),
-- Setup Servers
require('mason-lspconfig').setup({
ensure_installed = vim.tbl_keys(servers),
handlers = {
function(server_name)
local opts = servers[server_name] or {}
opts.capabilities = capabilities
vim.lsp.config(server_name, opts)
vim.lsp.enable(server_name)
end,
},
})
-- Tab to change item in completion menu
['<Tab>'] = cmp.mapping.select_next_item(cmp_select_behavior),
-- Shift+Tab goes to the previus item in the completion menu
['<S-Tab>'] = cmp.mapping.select_prev_item(cmp_select_behavior),
-- LspAttach (Keybindings & Activation)
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(ev)
local opts = { buffer = ev.buf }
local client = vim.lsp.get_client_by_id(ev.data.client_id)
-- Navigate between documentation
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'path' },
{ name = 'luasnip' },
{ name = 'buffer' },
-- Copilot Source
{ name = "copilot", group_index = 2 },
}),
})
end,
dependencies = {
'L3MON4D3/LuaSnip',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-cmdline',
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-path',
'hrsh7th/nvim-cmp',
'saadparwaiz1/cmp_luasnip',
{ 'j-hui/fidget.nvim', opts = {} },
},
},
if client and client:supports_method('textDocument/completion') then
vim.lsp.completion.enable(true, client.id, ev.buf, {
autotrigger = true,
autoselect = false,
})
end
{
'mason-org/mason-lspconfig.nvim',
dependencies = {
{ 'mason-org/mason.nvim', opts = {} },
'neovim/nvim-lspconfig',
},
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
vim.keymap.set({ 'n', 'v' }, '<leader>ca', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', '<leader>f', function() vim.lsp.buf.format { async = true } end, opts)
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, opts)
opts = {
ensure_installed = { 'eslint', 'ts_ls', 'rust_analyzer', 'lua_ls', 'clangd', 'pyright', 'ruff' },
},
},
vim.keymap.set('i', '<CR>', function()
return vim.fn.pumvisible() ~= 0 and '<C-y>' or '<CR>'
end, { expr = true, buffer = ev.buf })
{
"L3MON4D3/LuaSnip", -- Snippet engine
keys = {
-- Move up in snippet fields
{
"<C-k>",
function()
local ls = require("luasnip")
if ls.jumpable(-1) then
ls.jump(-1)
end
end,
mode = { "i", "s" },
desc = "Jump to the previous snippet field",
silent = true,
},
-- Move down in snippet fields
{
"<C-j>",
function()
local ls = require("luasnip")
if ls.expand_or_jumpable() then
ls.expand_or_jump()
end
end,
mode = { "i", "s" },
desc = "Expand or jump to the next snippet field",
silent = true,
},
},
},
vim.keymap.set('i', '<Tab>', function()
return vim.fn.pumvisible() ~= 0 and '<C-n>' or '<Tab>'
end, { expr = true, buffer = ev.buf })
vim.keymap.set('i', '<S-Tab>', function()
return vim.fn.pumvisible() ~= 0 and '<C-p>' or '<S-Tab>'
end, { expr = true, buffer = ev.buf })
vim.keymap.set('i', '<C-k>', function()
vim.api.nvim_feedkeys(
vim.api.nvim_replace_termcodes('<C-x><C-o>', true, false, true),
'n', false
)
end, { buffer = ev.buf })
-- Check if the server supports signature help and show function
-- signature when typing
-- Inside LspAttach:
-- if client and client:supports_method('textDocument/signatureHelp') then
-- -- Wrap the CursorMovedI in a group to prevent duplicates
-- local sig_group = vim.api.nvim_create_augroup('UserSignatureHelp', { clear = false })
-- vim.api.nvim_clear_autocmds({ group = sig_group, buffer = ev.buf })
-- vim.api.nvim_create_autocmd("CursorMovedI", {
-- group = sig_group,
-- buffer = ev.buf,
-- callback = function()
-- pcall(vim.lsp.buf.signature_help, { focusable = false, silent = true })
-- end,
-- })
-- end
end,
})
end,
}
}

View File

@@ -3,6 +3,7 @@ return {
"L3MON4D3/LuaSnip",
dependencies = { "rafamadriz/friendly-snippets" },
version = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
enabled = false,
-- install jsregexp (optional!).
build = "make install_jsregexp",
config = function ()

View File

@@ -1,25 +1,22 @@
return {
"nvim-telescope/telescope.nvim",
tag = "0.1.5",
config = function()
require('telescope').setup({
defaults = {
mappings = {
i = {
['<Tab>'] = 'move_selection_previous',
['<S-Tab>'] = 'move_selection_next',
['<C-f>'] = 'preview_scrolling_up',
}
}
}
})
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
vim.keymap.set('n', '<leader>ps', function()
builtin.grep_string({ search = vim.fn.input("Grep > ") });
end)
vim.keymap.set('n', '<leader>gf', builtin.git_files, {})
vim.keymap.set('n', 'gr', builtin.lsp_references)
end,
dependencies = { "nvim-lua/plenary.nvim" }
"nvim-telescope/telescope.nvim",
tag = "0.1.5",
opts = {
defaults = {
mappings = {
i = {
['<Tab>'] = 'move_selection_previous',
['<S-Tab>'] = 'move_selection_next',
['<C-f>'] = 'preview_scrolling_up',
}
}
}
},
keys = {
{ "<leader>pf", function() require("telescope.builtin").find_files() end },
{ "<leader>ps", function() require("telescope.builtin").grep_string({ search = vim.fn.input("Grep > ") }) end },
{ "<leader>gf", function() require("telescope.builtin").git_files() end },
{ "<leader>gr", function() require("telescope.builtin").lsp_references() end },
},
dependencies = { "nvim-lua/plenary.nvim" }
}

View File

@@ -1,20 +0,0 @@
return {
{
enabled = false,
"christoomey/vim-tmux-navigator",
cmd = {
"TmuxNavigateLeft",
"TmuxNavigateDown",
"TmuxNavigateUp",
"TmuxNavigateRight",
"TmuxNavigatePrevious",
},
keys = {
{ "<c-h>", "<cmd><C-U>TmuxNavigateLeft<cr>" },
{ "<c-j>", "<cmd><C-U>TmuxNavigateDown<cr>" },
{ "<c-k>", "<cmd><C-U>TmuxNavigateUp<cr>" },
{ "<c-l>", "<cmd><C-U>TmuxNavigateRight<cr>" },
{ "<c-\\>", "<cmd><C-U>TmuxNavigatePrevious<cr>" },
},
}
}

View File

@@ -0,0 +1,25 @@
return {
"romus204/tree-sitter-manager.nvim",
dependencies = {}, -- tree-sitter CLI must be installed system-wide
opts = {
ensure_installed = {
"bash",
"c",
"cpp",
"css",
"go",
"html",
"javascript",
"json",
"lua",
"python",
"rust",
"typescript",
"yaml"
}, -- list of parsers to install at the start of a neovim session
-- Default Options
-- ensure_installed = {}, -- list of parsers to install at the start of a neovim session
-- border = nil, -- border style for the window (e.g. "rounded", "single"), if nil, use the default border style defined by 'vim.o.winborder'. See :h 'winborder' for more info.
-- auto_install = false, -- if enabled, install missing parsers when editing a new file
},
}

View File

@@ -1,32 +0,0 @@
return {
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate",
config = function()
require('nvim-treesitter.configs').setup({
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = {"javascript", "typescript", "rust", "c", "lua", "vim", "vimdoc", "query" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
-- List of parsers to ignore installing (for "all")
-- ignore_install = { "javascript" },
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
highlight = {
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
})
end
}
}

View File

@@ -1,6 +1,6 @@
return {
"folke/trouble.nvim",
opts = {}, -- for default options, refer to the configuration section for custom setup.
opts = {},
cmd = "Trouble",
keys = {
{

View File

@@ -1,7 +1,6 @@
return {
{'mbbill/undotree',
config = function ()
vim.keymap.set('n', '<leader>u', vim.cmd.UndotreeToggle)
end
}
'mbbill/undotree',
keys = {
{ "<leader>u", vim.cmd.UndotreeToggle, desc = "Toggle Undotree" },
},
}