fix cmp mapping
This commit is contained in:
parent
e22ed2d5a4
commit
5218a5331d
1 changed files with 59 additions and 32 deletions
|
@ -72,41 +72,68 @@
|
||||||
|
|
||||||
plugins.cmp = {
|
plugins.cmp = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings.sources = [
|
settings = {
|
||||||
{ name = "nvim_lsp"; }
|
formatting.fields = [
|
||||||
{ name = "luasnip"; }
|
"abbr"
|
||||||
{ name = "buffer"; }
|
"kind"
|
||||||
{ name = "nvim_lua"; }
|
"menu"
|
||||||
{ name = "path"; }
|
];
|
||||||
];
|
experimental = {
|
||||||
|
ghost_text = true;
|
||||||
settings.mappings = {
|
};
|
||||||
"<C-h>" = "cmp.mapping.abort()";
|
snippet.expand = ''
|
||||||
"<C-n>" = "cmp.mapping.select_next_item()";
|
function(args) require('luasnip').lsp_expand(args.body) end
|
||||||
"<C-p>" = "cmp.mapping.select_prev_item()";
|
|
||||||
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
|
|
||||||
"<C-u>" = "cmp.mapping.scroll_docs(4)";
|
|
||||||
"<C-k>" = "cmp.mapping.confirm({ select = true })";
|
|
||||||
"<Tab>" = ''
|
|
||||||
cmp.mapping(function(fallback)
|
|
||||||
if require("luasnip").expand_or_jumpable() then
|
|
||||||
require("luasnip").expand_or_jump()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end,{"i","s"})
|
|
||||||
'';
|
|
||||||
"<S-Tab>" = ''
|
|
||||||
cmp.mapping(function(fallback)
|
|
||||||
if require("luasnip").jumpable(-1) then
|
|
||||||
require("luasnip").jump(-1)
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end,{"i","s"})
|
|
||||||
'';
|
'';
|
||||||
|
sources = [
|
||||||
|
{ name = "nvim_lsp"; }
|
||||||
|
{ name = "emoji"; }
|
||||||
|
{ name = "luasnip"; }
|
||||||
|
{ name = "buffer"; }
|
||||||
|
{ name = "path"; }
|
||||||
|
];
|
||||||
|
mapping = {
|
||||||
|
"<C-h>" = "cmp.mapping.abort()";
|
||||||
|
"<C-n>" = "cmp.mapping.select_next_item()";
|
||||||
|
"<C-p>" = "cmp.mapping.select_prev_item()";
|
||||||
|
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
|
||||||
|
"<C-u>" = "cmp.mapping.scroll_docs(4)";
|
||||||
|
"<C-k>" = ''
|
||||||
|
cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
if require("luasnip").expandable() then
|
||||||
|
require("luasnip").expand()
|
||||||
|
else
|
||||||
|
cmp.confirm({
|
||||||
|
select = true,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
'';
|
||||||
|
"<Tab>" = ''
|
||||||
|
cmp.mapping(function(fallback)
|
||||||
|
if require("luasnip").jumpable(1) then
|
||||||
|
require("luasnip").jump(1)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end,{"i","s"})
|
||||||
|
'';
|
||||||
|
"<S-Tab>" = ''
|
||||||
|
cmp.mapping(function(fallback)
|
||||||
|
if require("luasnip").jumpable(-1) then
|
||||||
|
require("luasnip").jump(-1)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end,{"i","s"})
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
plugins.lsp = {
|
plugins.lsp = {
|
||||||
enable = true;
|
enable = true;
|
||||||
keymaps.lspBuf = {
|
keymaps.lspBuf = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue