Fixed a terrible nvim bug where pressing tab would error and type a 0
This commit is contained in:
parent
2fa03f227e
commit
ac9a7343c6
2 changed files with 22 additions and 13 deletions
|
@ -99,15 +99,15 @@ end
|
||||||
-- <<<
|
-- <<<
|
||||||
|
|
||||||
M.cmp = function() ---- cmp >>>
|
M.cmp = function() ---- cmp >>>
|
||||||
-- nvim-cmp supports additional completion capabilities
|
-- luasnip setup
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
local luasnip = require 'luasnip'
|
||||||
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
|
|
||||||
|
|
||||||
|
-- nvim-cmp setup
|
||||||
local cmp = require 'cmp'
|
local cmp = require 'cmp'
|
||||||
cmp.setup {
|
cmp.setup {
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
vim.fn["vsnip#anonymous"](args.body)
|
require('luasnip').lsp_expand(args.body)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
mapping = {
|
mapping = {
|
||||||
|
@ -144,7 +144,7 @@ M.cmp = function() ---- cmp >>>
|
||||||
{ name = 'path' },
|
{ name = 'path' },
|
||||||
{ name = 'buffer' },
|
{ name = 'buffer' },
|
||||||
{ name = 'calc' },
|
{ name = 'calc' },
|
||||||
{ name = 'vsnip' },
|
{ name = 'luasnip' },
|
||||||
{ name = 'nvim_lsp' },
|
{ name = 'nvim_lsp' },
|
||||||
{ name = 'nvim_lua' },
|
{ name = 'nvim_lua' },
|
||||||
{ name = 'spell' },
|
{ name = 'spell' },
|
||||||
|
@ -158,11 +158,14 @@ M.cmp = function() ---- cmp >>>
|
||||||
|
|
||||||
-- set a name for each source
|
-- set a name for each source
|
||||||
vim_item.menu = ({
|
vim_item.menu = ({
|
||||||
|
path = "[Path]",
|
||||||
buffer = "[Buffer]",
|
buffer = "[Buffer]",
|
||||||
nvim_lsp = "[LSP]",
|
calc = "[Calc]",
|
||||||
luasnip = "[LuaSnip]",
|
luasnip = "[LuaSnip]",
|
||||||
|
nvim_lsp = "[LSP]",
|
||||||
nvim_lua = "[Lua]",
|
nvim_lua = "[Lua]",
|
||||||
latex_symbols = "[Latex]",
|
spell = "[Spell]",
|
||||||
|
treesitter = "[TS]",
|
||||||
})[entry.source.name]
|
})[entry.source.name]
|
||||||
return vim_item
|
return vim_item
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -61,19 +61,25 @@ return require('packer').startup(function()
|
||||||
require('lsp').cmp()
|
require('lsp').cmp()
|
||||||
end,
|
end,
|
||||||
requires = { -- nvim-cmp sources
|
requires = { -- nvim-cmp sources
|
||||||
"hrsh7th/vim-vsnip",
|
-- snippet integration
|
||||||
"rafamadriz/friendly-snippets",
|
-- "hrsh7th/cmp-vsnip",
|
||||||
|
"saadparwaiz1/cmp_luasnip",
|
||||||
|
|
||||||
"hrsh7th/cmp-path",
|
"hrsh7th/cmp-path",
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
"hrsh7th/cmp-buffer",
|
"hrsh7th/cmp-buffer",
|
||||||
"hrsh7th/cmp-nvim-lua",
|
"hrsh7th/cmp-nvim-lua",
|
||||||
"hrsh7th/cmp-latex-symbols",
|
"hrsh7th/cmp-latex-symbols",
|
||||||
"hrsh7th/cmp-vsnip",
|
|
||||||
"hrsh7th/cmp-emoji",
|
"hrsh7th/cmp-emoji",
|
||||||
"hrsh7th/cmp-calc",
|
"hrsh7th/cmp-calc",
|
||||||
"hrsh7th/cmp-look",
|
"hrsh7th/cmp-look",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
use { -- code snippits
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
-- "hrsh7th/vim-vsnip",
|
||||||
|
-- "rafamadriz/friendly-snippets",
|
||||||
|
}
|
||||||
use { -- function parameter previews
|
use { -- function parameter previews
|
||||||
"ray-x/lsp_signature.nvim",
|
"ray-x/lsp_signature.nvim",
|
||||||
after = "nvim-lspconfig",
|
after = "nvim-lspconfig",
|
||||||
|
|
Loading…
Add table
Reference in a new issue