lsp updates

This commit is contained in:
Egor 2024-12-03 08:04:28 +03:00
parent 0731db0833
commit c8f3d194b6
5 changed files with 54 additions and 32 deletions

View file

@ -1,33 +1,33 @@
{ {
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
"bufferline.nvim": { "branch": "main", "commit": "2e3c8cc5a57ddd32f1edd2ffd2ccb10c09421f6c" }, "bufferline.nvim": { "branch": "main", "commit": "5c528bee3dd797d5bd6bae5f229411939b25b203" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"conform.nvim": { "branch": "master", "commit": "f5bd8419f8a29451e20bdb1061a54fe13d5c8de3" }, "conform.nvim": { "branch": "master", "commit": "a203480a350b03092e473bf3001733d547160a73" },
"friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" }, "friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" },
"go.nvim": { "branch": "master", "commit": "8389adb56ab124b75d858df5f87b741eaca7b8b3" }, "go.nvim": { "branch": "master", "commit": "6368756601a358b1491ac2ff10d0e2939a76df5e" },
"guihua.lua": { "branch": "master", "commit": "225db770e36aae6a1e9e3a65578095c8eb4038d3" }, "guihua.lua": { "branch": "master", "commit": "d783191eaa75215beae0c80319fcce5e6b3beeda" },
"langmapper.nvim": { "branch": "main", "commit": "62cc28b4ebc5f47e6d4a6b5dd478c93b812f7187" }, "langmapper.nvim": { "branch": "main", "commit": "efeffd2a0add17ad04c69beb81b68329cd445eeb" },
"lazy.nvim": { "branch": "main", "commit": "48b52b5cfcf8f88ed0aff8fde573a5cc20b1306d" }, "lazy.nvim": { "branch": "main", "commit": "56ead98e05bb37a4ec28930a54d836d033cf00f2" },
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" }, "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "482350b050bd413931c2cdd4857443c3da7d57cb" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "8e46de9241d3997927af12196bd8faa0ed08c29a" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"nvim": { "branch": "main", "commit": "4fd72a9ab64b393c2c22b168508fd244877fec96" }, "nvim": { "branch": "main", "commit": "faf15ab0201b564b6368ffa47b56feefc92ce3f4" },
"nvim-autopairs": { "branch": "master", "commit": "19606af7c039271d5aa96bceff101e7523af3136" }, "nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" },
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, "nvim-cmp": { "branch": "main", "commit": "ed31156aa2cc14e3bc066c59357cc91536a2bc01" },
"nvim-lspconfig": { "branch": "master", "commit": "3ad562700d0615818bf358268ac8914f6ce2b079" }, "nvim-lspconfig": { "branch": "master", "commit": "e8f9c46c99e1901167a92ab13e2357158e5aabdb" },
"nvim-neoclip.lua": { "branch": "main", "commit": "709c97fabec9da7d04f7d2f5e207423af8c02871" }, "nvim-neoclip.lua": { "branch": "main", "commit": "32e05f2d23dc5b6a284a688c0535a83d1bfc633f" },
"nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" }, "nvim-surround": { "branch": "main", "commit": "9f0cb495f25bff32c936062d85046fbda0c43517" },
"nvim-tree.lua": { "branch": "master", "commit": "ea55ef12036897fdc4476b115a395d2a34965c82" }, "nvim-tree.lua": { "branch": "master", "commit": "ca7c4c33cac2ad66ec69d45e465379716ef0cc97" },
"nvim-treesitter": { "branch": "master", "commit": "2d8f0f37c4056022b6643cbe8671319881f8b369" }, "nvim-treesitter": { "branch": "master", "commit": "4d035005d338e4b1eb71a175bd44974e2f64740f" },
"nvim-web-devicons": { "branch": "master", "commit": "3722e3d1fb5fe1896a104eb489e8f8651260b520" }, "nvim-web-devicons": { "branch": "master", "commit": "edbe0a65cfacbbfff6a4a1e98ddd60c28c560509" },
"plenary.nvim": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"sqlite.lua": { "branch": "master", "commit": "d0ffd703b56d090d213b497ed4eb840495f14a11" }, "sqlite.lua": { "branch": "master", "commit": "d0ffd703b56d090d213b497ed4eb840495f14a11" },
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" }, "trouble.nvim": { "branch": "main", "commit": "46cf952fc115f4c2b98d4e208ed1e2dce08c9bf6" },
"vim-be-good": { "branch": "master", "commit": "4fa57b7957715c91326fcead58c1fa898b9b3625" } "vim-be-good": { "branch": "master", "commit": "4fa57b7957715c91326fcead58c1fa898b9b3625" }
} }

View file

@ -7,3 +7,6 @@ vim.keymap.set('n', '<c-k>', '<c-w><Up>')
vim.keymap.set('n', '<c-h>', '<c-w><Left>') vim.keymap.set('n', '<c-h>', '<c-w><Left>')
vim.keymap.set('n', '<c-l>', '<c-w><Right>') vim.keymap.set('n', '<c-l>', '<c-w><Right>')
vim.keymap.set('n', '<leader><cr>', ':lua vim.lsp.buf.code_action()<cr>') vim.keymap.set('n', '<leader><cr>', ':lua vim.lsp.buf.code_action()<cr>')
vim.keymap.set('n', '<S-d>', ':lua vim.lsp.buf.hover()<cr>')
vim.keymap.set('n', '<S-r>', ':lua vim.lsp.buf.rename()<cr>')
vim.keymap.set('n', '<S-i>', ':lua vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled(), { bufnr })<cr>')

View file

@ -22,4 +22,3 @@ vim.opt.incsearch = true
vim.opt.hlsearch = false vim.opt.hlsearch = false
vim.opt.ignorecase = true vim.opt.ignorecase = true
vim.opt.smartcase = true vim.opt.smartcase = true

View file

@ -48,6 +48,10 @@ return {
luasnip.lsp_expand(args.body) luasnip.lsp_expand(args.body)
end end
}, },
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered()
},
mapping = cmp.mapping.preset.insert({ mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4), ['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4), ['<C-f>'] = cmp.mapping.scroll_docs(4),
@ -87,12 +91,26 @@ return {
config = function() config = function()
local lspconfig = require('lspconfig') local lspconfig = require('lspconfig')
local lsp_capabilities = require('cmp_nvim_lsp').default_capabilities() local lsp_capabilities = require('cmp_nvim_lsp').default_capabilities()
lspconfig.lua_ls.setup({ capabilities = lsp_capabilities }) local servers = { 'lua_ls', 'pylsp', 'gopls', 'typst_lsp', 'clangd', 'cmake' }
lspconfig.rust_analyzer.setup({ capabilities = lsp_capabilities }) for _, lsp in ipairs(servers) do
lspconfig.gopls.setup({ capabilities = lsp_capabilities }) lspconfig[lsp].setup({
lspconfig.typst_lsp.setup({ capabilities = lsp_capabilities }) capabilities = lsp_capabilities
lspconfig.clangd.setup({ capabilities = lsp_capabilities }) })
lspconfig.cmake.setup({ capabilities = lsp_capabilities }) end
lspconfig['omnisharp'].setup({
cmd = { "/home/egor/.local/share/nvim/mason/bin/omnisharp" },
capabilities = lsp_capabilities
})
lspconfig['rust_analyzer'].setup({
capabilities = lsp_capabilities,
settings = {
['rust-analyzer'] = {
inlayHints = {
typeHints = { enable = true }
}
}
}
})
end end
}, },
} }

View file

@ -3,16 +3,18 @@ return {
dependencies = { dependencies = {
'nvim-tree/nvim-web-devicons' 'nvim-tree/nvim-web-devicons'
}, },
config = function () config = function()
vim.g.loaded_netrw = 1 vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1 vim.g.loaded_netrwPlugin = 1
vim.keymap.set('n', '<leader>e', ':NvimTreeToggle<cr>') vim.keymap.set('n', '<leader>e', ':NvimTreeToggle<cr>')
require('nvim-tree').setup({ require('nvim-tree').setup({
filters = { filters = {
dotfiles = true dotfiles = false,
git_ignored = false,
custom = { '^.git$' }
} }
}) })
vim.api.nvim_create_autocmd({"QuitPre"}, { vim.api.nvim_create_autocmd({ "QuitPre" }, {
callback = function() vim.cmd("NvimTreeClose") end, callback = function() vim.cmd("NvimTreeClose") end,
}) })
end end