remove snippet option for cmp | fix telescope first time delay
This commit is contained in:
parent
ca481b1385
commit
a21e884983
3 changed files with 17 additions and 30 deletions
|
@ -69,7 +69,6 @@ M.plugins = {
|
||||||
lspsignature = true, -- lsp enhancements
|
lspsignature = true, -- lsp enhancements
|
||||||
vim_matchup = true, -- improved matchit
|
vim_matchup = true, -- improved matchit
|
||||||
cmp = true,
|
cmp = true,
|
||||||
snippets = true,
|
|
||||||
nvimtree = true,
|
nvimtree = true,
|
||||||
autopairs = true,
|
autopairs = true,
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,21 +4,13 @@ if not present then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local snippets_status = require("core.utils").load_config().plugins.status.snippets
|
vim.opt.completeopt = "menuone,noselect"
|
||||||
|
|
||||||
local default = {
|
local default = {
|
||||||
completion = {
|
snippet = {
|
||||||
completeopt = "menuone,noselect",
|
|
||||||
},
|
|
||||||
documentation = {
|
|
||||||
border = "single",
|
|
||||||
},
|
|
||||||
snippet = (snippets_status and {
|
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
require("luasnip").lsp_expand(args.body)
|
require("luasnip").lsp_expand(args.body)
|
||||||
end,
|
end,
|
||||||
}) or {
|
|
||||||
expand = function(_) end,
|
|
||||||
},
|
},
|
||||||
formatting = {
|
formatting = {
|
||||||
format = function(entry, vim_item)
|
format = function(entry, vim_item)
|
||||||
|
@ -26,10 +18,9 @@ local default = {
|
||||||
vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind)
|
vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind)
|
||||||
|
|
||||||
vim_item.menu = ({
|
vim_item.menu = ({
|
||||||
buffer = "[BUF]",
|
|
||||||
nvim_lsp = "[LSP]",
|
nvim_lsp = "[LSP]",
|
||||||
nvim_lua = "[Lua]",
|
nvim_lua = "[Lua]",
|
||||||
path = "[Path]",
|
buffer = "[BUF]",
|
||||||
})[entry.source.name]
|
})[entry.source.name]
|
||||||
|
|
||||||
return vim_item
|
return vim_item
|
||||||
|
@ -46,24 +37,24 @@ local default = {
|
||||||
behavior = cmp.ConfirmBehavior.Replace,
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
select = true,
|
select = true,
|
||||||
},
|
},
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
["<Tab>"] = function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_next_item()
|
cmp.select_next_item()
|
||||||
elseif snippets_status and require("luasnip").expand_or_jumpable() then
|
elseif require("luasnip").expand_or_jumpable() then
|
||||||
require("luasnip").expand_or_jump()
|
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
end, { "i", "s" }),
|
end,
|
||||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
["<S-Tab>"] = function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_prev_item()
|
cmp.select_prev_item()
|
||||||
elseif require("luasnip").jumpable(-1) then
|
elseif require("luasnip").jumpable(-1) then
|
||||||
require("luasnip").jump(-1)
|
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
end, { "i", "s" }),
|
end,
|
||||||
},
|
},
|
||||||
sources = {
|
sources = {
|
||||||
{ name = "nvim_lsp" },
|
{ name = "nvim_lsp" },
|
||||||
|
|
|
@ -115,7 +115,7 @@ local plugins = {
|
||||||
{
|
{
|
||||||
"max397574/better-escape.nvim",
|
"max397574/better-escape.nvim",
|
||||||
disable = not plugin_settings.status.better_escape,
|
disable = not plugin_settings.status.better_escape,
|
||||||
event = "InsertEnter",
|
event = "InsertCharPre",
|
||||||
config = override_req("better_escape", "plugins.configs.others", "better_escape"),
|
config = override_req("better_escape", "plugins.configs.others", "better_escape"),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -124,23 +124,20 @@ local plugins = {
|
||||||
{
|
{
|
||||||
"rafamadriz/friendly-snippets",
|
"rafamadriz/friendly-snippets",
|
||||||
module = "cmp_nvim_lsp",
|
module = "cmp_nvim_lsp",
|
||||||
disable = not (plugin_settings.status.cmp and plugin_settings.status.snippets),
|
disable = not plugin_settings.status.cmp,
|
||||||
event = "InsertEnter",
|
event = "InsertCharPre",
|
||||||
},
|
},
|
||||||
|
|
||||||
-- cmp by default loads after friendly snippets
|
|
||||||
-- if snippets are disabled -> cmp loads on insertEnter!
|
|
||||||
{
|
{
|
||||||
"hrsh7th/nvim-cmp",
|
"hrsh7th/nvim-cmp",
|
||||||
disable = not plugin_settings.status.cmp,
|
disable = not plugin_settings.status.cmp,
|
||||||
event = not plugin_settings.status.snippets and "InsertEnter",
|
after = "friendly-snippets",
|
||||||
after = plugin_settings.status.snippets and "friendly-snippets",
|
|
||||||
config = override_req("nvim_cmp", "plugins.configs.cmp", "setup"),
|
config = override_req("nvim_cmp", "plugins.configs.cmp", "setup"),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"L3MON4D3/LuaSnip",
|
"L3MON4D3/LuaSnip",
|
||||||
disable = not (plugin_settings.status.cmp and plugin_settings.status.snippets),
|
disable = not plugin_settings.status.cmp,
|
||||||
wants = "friendly-snippets",
|
wants = "friendly-snippets",
|
||||||
after = "nvim-cmp",
|
after = "nvim-cmp",
|
||||||
config = override_req("luasnip", "plugins.configs.others", "luasnip"),
|
config = override_req("luasnip", "plugins.configs.others", "luasnip"),
|
||||||
|
@ -148,14 +145,14 @@ local plugins = {
|
||||||
|
|
||||||
{
|
{
|
||||||
"saadparwaiz1/cmp_luasnip",
|
"saadparwaiz1/cmp_luasnip",
|
||||||
disable = not (plugin_settings.status.cmp and plugin_settings.status.snippets),
|
disable = not plugin_settings.status.cmp,
|
||||||
after = plugin_settings.options.cmp.lazy_load and "LuaSnip",
|
after = plugin_settings.options.cmp.lazy_load and "LuaSnip",
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"hrsh7th/cmp-nvim-lua",
|
"hrsh7th/cmp-nvim-lua",
|
||||||
disable = not plugin_settings.status.cmp,
|
disable = not plugin_settings.status.cmp,
|
||||||
after = (plugin_settings.status.snippets and "cmp_luasnip") or "nvim-cmp",
|
after = "cmp_luasnip",
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue