fix nvim config

This commit is contained in:
Johannes Knopp
2026-02-22 17:06:22 +01:00
parent 4093701fca
commit 545f8ab328
10 changed files with 95 additions and 120 deletions

View File

@ -12,6 +12,7 @@
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
"flutter-tools.nvim": { "branch": "main", "commit": "293dfc78162ab185bca5f81bb32155dcf45114bf" },
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
"lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" },
"lazygit.nvim": { "branch": "main", "commit": "a04ad0dbc725134edbee3a5eea29290976695357" },
"lspkind.nvim": { "branch": "master", "commit": "3ddd1b4edefa425fda5a9f95a4f25578727c0bb3" },
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
@ -19,7 +20,6 @@
"mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" },
"mason.nvim": { "branch": "main", "commit": "4da89f3ab04783da990f9bd40aaa36c22e59375b" },
"monokai-nightasty.nvim": { "branch": "main", "commit": "8be5e1c6e1d59873505e81b161e923264dfa5c1a" },
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
"none-ls-extras.nvim": { "branch": "main", "commit": "03955d165621300965a6d685c8f399ec7efd5785" },
"none-ls.nvim": { "branch": "main", "commit": "0b457958cb958c16850b5a1fb38bbcd982909181" },
"nvim-autopairs": { "branch": "master", "commit": "c2a0dd0d931d0fb07665e1fedb1ea688da3b80b4" },
@ -34,7 +34,6 @@
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" },
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" },
"vim-floaterm": { "branch": "master", "commit": "a11b930f55324e9b05e2ef16511fe713f1b456a7" },
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
}

View File

@ -39,6 +39,7 @@ return {
['<Enter>'] = cmp.mapping.confirm({ select = true }),
}),
sources = cmp.config.sources({
{ name = 'lazydev', group_index = 0 },
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'buffer' },

View File

@ -8,7 +8,7 @@ return {
'LazyGitFilter',
'LazyGitFilterCurrentFile',
},
depedencies = {
dependencies = {
'nvim-lua/plenary.nvim',
},
}

View File

@ -5,11 +5,17 @@ return {
'williamboman/mason.nvim',
'hrsh7th/cmp-nvim-lsp',
{ 'antosha417/nvim-lsp-file-operations', config = true },
{ 'folke/neodev.nvim', opts = {} },
{
'folke/lazydev.nvim',
ft = 'lua',
opts = {
library = {
{ path = '${3rd}/luv/library', words = { 'vim%.uv' } },
},
},
},
},
config = function()
local lspconfig = vim.lsp
local mason_lspconfig = require('mason-lspconfig')
local cmp_nvim_lsp = require('cmp_nvim_lsp')
local keymap = vim.keymap
local wk = require('which-key')
@ -37,98 +43,40 @@ return {
end,
})
-- Apply default capabilities to all servers
local capabilities = cmp_nvim_lsp.default_capabilities()
mason_lspconfig.setup_handlers({
-- default handler for installed servers
function(server_name)
lspconfig.enable(server_name, {
capabilities = capabilities,
})
end,
-- TODO add lsp configs
['lua_ls'] = function()
lspconfig.enable('lua_ls', {
capabilities = capabilities,
settings = {
Lua = {
diagnostics = {
globals = { 'vim' },
},
completion = {
callSnippet = 'Replace'
},
}
}
})
end,
['emmet_ls'] = function()
-- capabilities.textDocument.completion.completionItem.snippetSupport = true
lspconfig.enable('emmet_ls', {
capabilities = capabilities,
filetypes = {
'html',
'css',
'sass',
'scss',
'less',
'javascript',
'javascriptreact',
'typescript',
'typescriptreact',
'svelte',
'vue',
}
})
end,
['ts_ls'] = function()
lspconfig.enable('ts_ls', {
capabilities = capabilities,
cmd = { "typescript-language-server", "--stdio" },
init_options = {
hostInfo = "neovim",
-- preferences = {
-- includePackagesJsonAutoImports = "on",
-- }
}
})
end,
['hyprls'] = function ()
lspconfig.hyprls.setup({
capabilities = capabilities,
cmd = { "hyprls" },
root_dir = function(fname)
return vim.fn.getcwd()
end,
})
end,
-- ['pyright'] = function()
-- lspconfig['pyright'].setup({
-- -- cmd = { "pyright-langserver", "--stdio" },
-- -- filetypes = { "python" },
-- -- root_dir = function(filename)
-- -- return util.root_pattern(unpack(root_files))(filename) or util.path.dirname(filename)
-- -- end,
-- -- settings = {
-- -- python = {
-- -- analysis = {
-- -- autoSearchPaths = true,
-- -- diagnosticMode = "workspace",
-- -- useLibraryCodeForTypes = true
-- -- }
-- -- }
-- -- }
-- capabilities = capabilities,
-- settings = {
-- python = {
-- analysis = {
-- useLibraryCodeForTypes = true,
-- typeCheckingMode = "basic",
-- -- configPath = vim.fn.expand('./pyrightconfig.json')
-- }
-- }
-- },
-- })
-- end,
vim.lsp.config('*', { capabilities = capabilities })
-- lua_ls: suppress vim global warnings, improve completion
vim.lsp.config('lua_ls', {
settings = {
Lua = {
diagnostics = {
globals = { 'vim' },
},
completion = {
callSnippet = 'Replace',
},
},
},
})
end
-- ts_ls: explicit host info
vim.lsp.config('ts_ls', {
cmd = { 'typescript-language-server', '--stdio' },
init_options = {
hostInfo = 'neovim',
},
})
-- hyprls: not managed by mason, enable manually
vim.lsp.config('hyprls', {
cmd = { 'hyprls' },
filetypes = { 'hyprlang' },
root_dir = function(fname)
return vim.fn.getcwd()
end,
})
vim.lsp.enable('hyprls')
end,
}

View File

@ -1,6 +1,6 @@
return {
{ 'williamboman/mason.nvim', commit = '4da89f3' },
{ 'williamboman/mason-lspconfig.nvim', commit = '1a31f82' },
{ 'williamboman/mason.nvim' },
{ 'williamboman/mason-lspconfig.nvim' },
{ 'WhoIsSethDaniel/mason-tool-installer.nvim' },
config = function()
local mason = require('mason')
@ -10,14 +10,14 @@ return {
mason.setup({
ui = {
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = "",
package_installed = '',
package_pending = '',
package_uninstalled = '',
},
},
pip = {
upgrade_pip = true,
}
},
})
mason_lspconfig.setup({
@ -39,7 +39,7 @@ return {
-- 'black',
-- 'pylint',
-- 'eslint_d',
}
},
})
end,
}