setup lsp and cmp
This commit is contained in:
parent
ecc18f4f63
commit
df92d9d391
3 changed files with 36 additions and 2 deletions
20
after/plugin/cmp.lua
Normal file
20
after/plugin/cmp.lua
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
local cmp = require("cmp")
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
require("luasnip").lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
{ name = "nvim_lsp_signature_help" },
|
||||||
|
{ name = "buffer" },
|
||||||
|
{ name = "luasnip" },
|
||||||
|
}),
|
||||||
|
formatting = {
|
||||||
|
format = require("lspkind").cmp_format({
|
||||||
|
mode = "symbol_text",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
})
|
|
@ -1,6 +1,12 @@
|
||||||
|
require("lspkind").init({
|
||||||
|
mode = "symbol_text",
|
||||||
|
})
|
||||||
|
|
||||||
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||||
local lspconfig = require("lspconfig")
|
local lspconfig = require("lspconfig")
|
||||||
|
|
||||||
lspconfig.lua_ls.setup({
|
lspconfig.lua_ls.setup({
|
||||||
|
capabilities = capabilities,
|
||||||
on_init = function(client)
|
on_init = function(client)
|
||||||
local path = client.workspace_folders[1].name
|
local path = client.workspace_folders[1].name
|
||||||
if not vim.loop.fs_stat(path .. "/.luarc.json") and not vim.loop.fs_stat(path .. "/.luarc.jsonc") then
|
if not vim.loop.fs_stat(path .. "/.luarc.json") and not vim.loop.fs_stat(path .. "/.luarc.jsonc") then
|
||||||
|
@ -23,4 +29,6 @@ lspconfig.lua_ls.setup({
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
lspconfig.nixd.setup({})
|
lspconfig.nixd.setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
})
|
||||||
|
|
|
@ -6,10 +6,16 @@ return require("packer").startup(function(use)
|
||||||
use("akinsho/toggleterm.nvim")
|
use("akinsho/toggleterm.nvim")
|
||||||
use("wesleimp/stylua.nvim")
|
use("wesleimp/stylua.nvim")
|
||||||
use("neovim/nvim-lspconfig")
|
use("neovim/nvim-lspconfig")
|
||||||
|
use("hrsh7th/nvim-cmp")
|
||||||
|
use("hrsh7th/cmp-nvim-lsp")
|
||||||
|
use("hrsh7th/cmp-nvim-lsp-signature-help")
|
||||||
|
use("L3MON4D3/LuaSnip")
|
||||||
|
use("saadparwaiz1/cmp_luasnip")
|
||||||
|
use("hrsh7th/cmp-buffer")
|
||||||
|
use("onsails/lspkind.nvim")
|
||||||
|
|
||||||
use({
|
use({
|
||||||
"akinsho/bufferline.nvim",
|
"akinsho/bufferline.nvim",
|
||||||
as = "bufferline.nvim",
|
|
||||||
requires = {
|
requires = {
|
||||||
{ "nvim-tree/nvim-web-devicons" },
|
{ "nvim-tree/nvim-web-devicons" },
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue