Add config.plugins.status.snippets to enable/disable snippets
This commit is contained in:
parent
ee5b79d3d4
commit
2a02054a39
3 changed files with 11 additions and 7 deletions
|
@ -4,10 +4,12 @@ if not present then
|
|||
return
|
||||
end
|
||||
|
||||
local snippets_status = require("core.utils").load_config().plugins.status.snippets
|
||||
|
||||
vim.opt.completeopt = "menuone,noselect"
|
||||
|
||||
local default = {
|
||||
snippet = {
|
||||
snippet = snippets_status and {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
|
@ -40,7 +42,7 @@ local default = {
|
|||
["<Tab>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif require("luasnip").expand_or_jumpable() then
|
||||
elseif snippents_status and require("luasnip").expand_or_jumpable() then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
|
@ -49,7 +51,7 @@ local default = {
|
|||
["<S-Tab>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif require("luasnip").jumpable(-1) then
|
||||
elseif snippets_status and require("luasnip").jumpable(-1) then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue