mirror of
https://github.com/josean-dev/dev-environment-files.git
synced 2025-01-08 01:11:12 +01:00
Removed supertab functionality for nvim-cmp as it was causing issues for me
This commit is contained in:
parent
ceb94f555d
commit
61c54117e5
1 changed files with 0 additions and 29 deletions
|
@ -21,12 +21,6 @@ require("luasnip/loaders/from_vscode").lazy_load()
|
|||
|
||||
vim.opt.completeopt = "menu,menuone,noselect"
|
||||
|
||||
-- helper function for super tab functionality (not in youtube nvim video)
|
||||
local has_words_before = function()
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
end
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
|
@ -41,29 +35,6 @@ cmp.setup({
|
|||
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
|
||||
["<C-e>"] = cmp.mapping.abort(), -- close completion window
|
||||
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
||||
|
||||
-- super tab functionality (not in youtube nvim video)
|
||||
["<Tab>"] = cmp.mapping(function(fallback) -- use tab for next suggestion
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback) -- use shift-tab for prev suggestion
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
-- sources for autocompletion
|
||||
sources = cmp.config.sources({
|
||||
|
|
Loading…
Reference in a new issue