fix: Fixing the luasnip error while tabbing
This commit is contained in:
parent
57d0714362
commit
b63e1502a5
|
@ -1,6 +1,5 @@
|
||||||
vim.opt.completeopt = "menuone,noselect"
|
vim.opt.completeopt = "menuone,noselect"
|
||||||
|
|
||||||
local lspkind = require "plugins.configs.lspkind_icons"
|
|
||||||
local cmp = require "cmp"
|
local cmp = require "cmp"
|
||||||
|
|
||||||
-- nvim-cmp setup
|
-- nvim-cmp setup
|
||||||
|
@ -13,7 +12,11 @@ cmp.setup {
|
||||||
formatting = {
|
formatting = {
|
||||||
format = function(entry, vim_item)
|
format = function(entry, vim_item)
|
||||||
-- load lspkind icons
|
-- load lspkind icons
|
||||||
vim_item.kind = string.format("%s %s", lspkind.icons[vim_item.kind], vim_item.kind)
|
vim_item.kind = string.format(
|
||||||
|
"%s %s",
|
||||||
|
require("plugins.configs.lspkind_icons").icons[vim_item.kind],
|
||||||
|
vim_item.kind
|
||||||
|
)
|
||||||
|
|
||||||
vim_item.menu = ({
|
vim_item.menu = ({
|
||||||
nvim_lsp = "[LSP]",
|
nvim_lsp = "[LSP]",
|
||||||
|
@ -38,7 +41,7 @@ cmp.setup {
|
||||||
["<Tab>"] = function(fallback)
|
["<Tab>"] = function(fallback)
|
||||||
if vim.fn.pumvisible() == 1 then
|
if vim.fn.pumvisible() == 1 then
|
||||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<C-n>", true, true, true), "n")
|
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<C-n>", true, true, true), "n")
|
||||||
elseif luasnip.expand_or_jumpable() then
|
elseif require("luasnip").expand_or_jumpable() then
|
||||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
|
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
|
@ -47,7 +50,7 @@ cmp.setup {
|
||||||
["<S-Tab>"] = function(fallback)
|
["<S-Tab>"] = function(fallback)
|
||||||
if vim.fn.pumvisible() == 1 then
|
if vim.fn.pumvisible() == 1 then
|
||||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<C-p>", true, true, true), "n")
|
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<C-p>", true, true, true), "n")
|
||||||
elseif luasnip.jumpable(-1) then
|
elseif require("luasnip").jumpable(-1) then
|
||||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
|
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
|
|
Loading…
Reference in New Issue