neovim: setup language servers, cmp based completion
This commit is contained in:
parent
0b05d1a046
commit
2bba517486
2 changed files with 81 additions and 6 deletions
|
|
@ -55,9 +55,7 @@ require("lazy").setup({
|
|||
"kylechui/nvim-surround",
|
||||
version = "^3.0.0",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("nvim-surround").setup({})
|
||||
end
|
||||
opts = {},
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -74,15 +72,84 @@ require("lazy").setup({
|
|||
"nvim-tree/nvim-tree.lua",
|
||||
version = "^1.14.0",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
require("nvim-tree").setup({})
|
||||
end,
|
||||
opts = {},
|
||||
keys = {
|
||||
{ "<leader><tab>", "<cmd>NvimTreeToggle<cr>" },
|
||||
{ "<leader>fl", "<cmd>NvimTreeFindFile<cr>" },
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"mason-org/mason-lspconfig.nvim",
|
||||
version = "^v2.1.0",
|
||||
dependencies = {
|
||||
{ "mason-org/mason.nvim", version = "^v2.2.1", opts = {} },
|
||||
{ "neovim/nvim-lspconfig", version = "^v2.5.0"}
|
||||
},
|
||||
config = function()
|
||||
require("mason-lspconfig").setup({})
|
||||
|
||||
local lspconfig = require("lspconfig")
|
||||
for _, server in ipairs(require("mason-lspconfig").get_installed_servers()) do
|
||||
lspconfig[server].setup({})
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
version = "^v2.4.1",
|
||||
build = "make install_jsregexp",
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
},
|
||||
mapping = {
|
||||
["<C-n>"] = cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'}),
|
||||
["<C-p>"] = cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'}),
|
||||
["<C-y>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
local luasnip = require('luasnip')
|
||||
if cmp.visible() then
|
||||
cmp.confirm({ select = true })
|
||||
elseif luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {'i', 's'}),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
local luasnip = require('luasnip')
|
||||
if luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {'i', 's'}),
|
||||
}
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
branch = 'master',
|
||||
|
|
|
|||
|
|
@ -1,7 +1,15 @@
|
|||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" },
|
||||
"catppuccin": { "branch": "main", "commit": "cb5665990a797b102715188e73c44c3931b3b42e" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
||||
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "f2fa60409630ec2d24acf84494fb55e1d28d593c" },
|
||||
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "c2a0dd0d931d0fb07665e1fedb1ea688da3b80b4" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "85bbfad83f804f11688d1ab9486b459e699292d6" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "5bfcc89fd155b4ffc02d18ab3b7d19c2d4e246a7" },
|
||||
"nvim-surround": { "branch": "main", "commit": "1098d7b3c34adcfa7feb3289ee434529abd4afd1" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "321bc61580fd066b76861c32de3319c3a6d089e7" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
|
|
|
|||
Loading…
Reference in a new issue