fix broken tab completion in nvim
This commit is contained in:
@@ -69,9 +69,8 @@ local default_handlers = {
|
|||||||
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded" }),
|
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded" }),
|
||||||
}
|
}
|
||||||
|
|
||||||
-- this is the function that loads the extra snippets to luasnip
|
-- luasnip for Tab completion
|
||||||
-- from rafamadriz/friendly-snippets
|
local luasnip = require('luasnip')
|
||||||
require('luasnip.loaders.from_vscode').lazy_load()
|
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
-- No preselection
|
-- No preselection
|
||||||
@@ -92,12 +91,6 @@ cmp.setup({
|
|||||||
ghost_text = true,
|
ghost_text = true,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- mapping = cmp.mapping.preset.insert({
|
|
||||||
-- ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
|
|
||||||
-- ['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
|
|
||||||
-- ['<C-y>'] = cmp.mapping.confirm({ select = true }),
|
|
||||||
-- ['<C-Space>'] = cmp.mapping.complete(),
|
|
||||||
-- }),
|
|
||||||
mapping = {
|
mapping = {
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
@@ -108,11 +101,6 @@ cmp.setup({
|
|||||||
end
|
end
|
||||||
elseif luasnip.expand_or_jumpable() then
|
elseif luasnip.expand_or_jumpable() then
|
||||||
luasnip.expand_or_jump()
|
luasnip.expand_or_jump()
|
||||||
elseif has_words_before() then
|
|
||||||
cmp.complete()
|
|
||||||
if #cmp.get_entries() == 1 then
|
|
||||||
cmp.confirm({ select = true })
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
|
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
require("config.remap")
|
require("config.remap")
|
||||||
require("config.options")
|
require("config.options")
|
||||||
require("config.gruvbox")
|
require("config.gruvbox")
|
||||||
|
require("config.packer")
|
||||||
|
|||||||
Reference in New Issue
Block a user