Changes to nvim cmp
This commit is contained in:
parent
9da6cf9a0b
commit
6796e50944
3 changed files with 39 additions and 10 deletions
|
@ -1,5 +1,8 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
|
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
|
||||||
|
"Lua.diagnostics.globals": [
|
||||||
|
"vim"
|
||||||
|
],
|
||||||
"Lua.workspace.library": [
|
"Lua.workspace.library": [
|
||||||
"/home/afonso/.config/nvim",
|
"/home/afonso/.config/nvim",
|
||||||
"/etc/xdg/nvim",
|
"/etc/xdg/nvim",
|
||||||
|
|
|
@ -104,6 +104,8 @@ cmp.setup {
|
||||||
nvim_lsp = "(LSP)",
|
nvim_lsp = "(LSP)",
|
||||||
luasnip = "(Snippet)",
|
luasnip = "(Snippet)",
|
||||||
buffer = "(Text)",
|
buffer = "(Text)",
|
||||||
|
nvim_lsp_signature_help = "(Signature)",
|
||||||
|
nvim_lua = "(Nvim LSP)",
|
||||||
path = "(Path)",
|
path = "(Path)",
|
||||||
})[entry.source.name]
|
})[entry.source.name]
|
||||||
return vim_item
|
return vim_item
|
||||||
|
@ -118,8 +120,32 @@ cmp.setup {
|
||||||
},
|
},
|
||||||
sources = cmp.config.sources(
|
sources = cmp.config.sources(
|
||||||
{
|
{
|
||||||
{ name = "nvim_lsp" },
|
{ name = "nvim_lsp",
|
||||||
{ name = "luasnip" },
|
entry_filter = function(entry, context)
|
||||||
|
local kind = entry:get_kind()
|
||||||
|
local line = context.cursor_line
|
||||||
|
local col = context.cursor.col
|
||||||
|
local char_before_cursor = string.sub(line, col - 1, col)
|
||||||
|
|
||||||
|
|
||||||
|
if char_before_cursor == "." then
|
||||||
|
if kind == 2 or kind == 5 then
|
||||||
|
return true
|
||||||
|
else return false end
|
||||||
|
elseif string.match(line, "^%s*%w*$") then
|
||||||
|
if kind == 3 or kind == 6 then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
},
|
||||||
|
{ name = 'nvim_lua' },
|
||||||
|
{ name = 'luasnip'},
|
||||||
|
{ name = 'nvim_lsp_signature_help' },
|
||||||
{ name = "path" },
|
{ name = "path" },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,6 +53,8 @@ local plugins = packer.startup({ function(use)
|
||||||
use { "hrsh7th/nvim-cmp",
|
use { "hrsh7th/nvim-cmp",
|
||||||
requires = {
|
requires = {
|
||||||
"hrsh7th/cmp-nvim-lsp", -- lsp
|
"hrsh7th/cmp-nvim-lsp", -- lsp
|
||||||
|
"hrsh7th/cmp-nvim-lua", -- Nvim API completions
|
||||||
|
"hrsh7th/cmp-nvim-lsp-signature-help", -- Show function signatures
|
||||||
"hrsh7th/cmp-buffer", --buffer completions
|
"hrsh7th/cmp-buffer", --buffer completions
|
||||||
"hrsh7th/cmp-path", --path completions
|
"hrsh7th/cmp-path", --path completions
|
||||||
"hrsh7th/cmp-cmdline" --cmdline completions
|
"hrsh7th/cmp-cmdline" --cmdline completions
|
||||||
|
@ -61,6 +63,12 @@ local plugins = packer.startup({ function(use)
|
||||||
require "plugins.cmp"
|
require "plugins.cmp"
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use { "L3MON4D3/LuaSnip",
|
||||||
|
requires = {
|
||||||
|
"saadparwaiz1/cmp_luasnip"
|
||||||
|
},
|
||||||
|
}
|
||||||
-------------------------------------------------------LSP----------------------------------------------
|
-------------------------------------------------------LSP----------------------------------------------
|
||||||
|
|
||||||
use { "williamboman/mason.nvim",
|
use { "williamboman/mason.nvim",
|
||||||
|
@ -71,8 +79,6 @@ local plugins = packer.startup({ function(use)
|
||||||
|
|
||||||
use { "williamboman/mason-lspconfig.nvim" }
|
use { "williamboman/mason-lspconfig.nvim" }
|
||||||
|
|
||||||
use { "hrsh7th/cmp-nvim-lsp"}
|
|
||||||
|
|
||||||
use { "neovim/nvim-lspconfig",
|
use { "neovim/nvim-lspconfig",
|
||||||
config = function()
|
config = function()
|
||||||
require "plugins.lspconfig"
|
require "plugins.lspconfig"
|
||||||
|
@ -85,12 +91,6 @@ local plugins = packer.startup({ function(use)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
use { "L3MON4D3/LuaSnip",
|
|
||||||
requires = {
|
|
||||||
"rafamadriz/friendly-snippets",
|
|
||||||
"saadparwaiz1/cmp_luasnip"
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue