diff options
| author | Stefan Weigl-Bosker <stefan@s00.xyz> | 2025-03-02 17:47:10 -0500 |
|---|---|---|
| committer | Stefan Weigl-Bosker <stefan@s00.xyz> | 2025-03-02 17:47:10 -0500 |
| commit | 3fb87c7b8b2377a2cfc0f6e2b858a5b4f96f49d6 (patch) | |
| tree | 7efef9eec4b626cbcfd1d1396cb6dee4c73c7783 /modules/neovim/nvim/lua/config/lsp.lua | |
| parent | b5e3e6f12b41a9a1133744e139c5aa47d1bee006 (diff) | |
| download | home-3fb87c7b8b2377a2cfc0f6e2b858a5b4f96f49d6.tar.gz | |
update
Diffstat (limited to 'modules/neovim/nvim/lua/config/lsp.lua')
| -rw-r--r-- | modules/neovim/nvim/lua/config/lsp.lua | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/modules/neovim/nvim/lua/config/lsp.lua b/modules/neovim/nvim/lua/config/lsp.lua new file mode 100644 index 0000000..62caa5d --- /dev/null +++ b/modules/neovim/nvim/lua/config/lsp.lua @@ -0,0 +1,55 @@ +local servers = { + clangd = {}, + zls = {} +} + +require('blink.cmp').setup({ + keymap = { + preset = 'default', + ['<C-n>'] = { function(cmp) cmp.show() end, 'select_next' }, + ['<Enter>'] = { 'accept', 'fallback' }, + }, + completion = { + list = { + selection = { preselect = true, auto_insert = false }, + }, + menu = { + border = "rounded", + auto_show = false, + }, + documentation = { window = { border = 'rounded' } }, + }, + signature = { window = { border = 'rounded' } }, +}) + +vim.diagnostic.config({ + virtual_text = false, + float = { border = "rounded" }, + signs = false, + underline = true, + update_in_insert = false, + float = true, + jump = { float = true }, +}) + +vim.api.nvim_create_autocmd("LspAttach", { callback = function(args) + local client = vim.lsp.get_client_by_id(args.data.client_id) + + map('n', 'E', '<cmd>lua vim.lsp.buf.hover()<CR>', { silent = true }) + + if client:supports_method(methods.textDocument_formatting) then + vim.api.nvim_create_autocmd("BufWritePre", { + buffer = args.buf, + callback = function() + vim.lsp.buf.format({bufnr = args.buf, id = client_id}) + end + }) + end +end}) + +local lspconfig = require('lspconfig') + +for server, config in pairs(servers) do + config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities) + lspconfig[server].setup(config) +end |