aboutsummaryrefslogtreecommitdiffstats
path: root/modules/by-name
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/by-name/nv/nvim/mappings/default.nix28
-rw-r--r--modules/by-name/nv/nvim/plgs/nvim-cmp/default.nix52
2 files changed, 46 insertions, 34 deletions
diff --git a/modules/by-name/nv/nvim/mappings/default.nix b/modules/by-name/nv/nvim/mappings/default.nix
index 2e14cc80..4997f66c 100644
--- a/modules/by-name/nv/nvim/mappings/default.nix
+++ b/modules/by-name/nv/nvim/mappings/default.nix
@@ -27,34 +27,6 @@ in {
action = "<cmd>noh<CR><Esc>";
options.desc = "Disable the search highlighting and send Escape";
}
- {
- key = "hh";
- mode = ["i"];
- action.__raw = ''
- function()
- local cmp = require('cmp');
- local luasnip = require('luasnip');
-
- if cmp.visible() then
- cmp.select_next_item()
- elseif luasnip.expand_or_locally_jumpable() then
- luasnip.expand_or_jump()
- end
- end
- '';
- options.desc = "completion trigger/ forward in completen menu";
- }
- {
- key = "uu";
- mode = ["i"];
- action.__raw = ''
- function()
- local cmp = require('cmp');
- cmp.confirm()
- end
- '';
- options.desc = "confirm the selected item";
- }
{
key = "<C-Tab>";
diff --git a/modules/by-name/nv/nvim/plgs/nvim-cmp/default.nix b/modules/by-name/nv/nvim/plgs/nvim-cmp/default.nix
index f0754bd3..d3a20300 100644
--- a/modules/by-name/nv/nvim/plgs/nvim-cmp/default.nix
+++ b/modules/by-name/nv/nvim/plgs/nvim-cmp/default.nix
@@ -21,6 +21,50 @@ in {
"noselect" # Do not pre select one of the completions
];
+ keymaps = [
+ {
+ key = "hh";
+ mode = ["i"];
+ action.__raw = ''
+ function()
+ require('cmp').select_next_item()
+ end
+ '';
+ options.desc = "go forward in completion menu";
+ }
+ {
+ key = "uu";
+ mode = ["i"];
+ action.__raw = ''
+ function()
+ require('cmp').confirm()
+ end
+ '';
+ options.desc = "confirm the selected item";
+ }
+
+ {
+ key = "<C-d>";
+ mode = ["i"];
+ action.__raw = ''
+ function()
+ require('cmp').mapping.scroll_docs(-4)
+ end
+ '';
+ options.desc = "Scroll up by four lines";
+ }
+ {
+ key = "<C-f>";
+ mode = ["i"];
+ action.__raw = ''
+ function()
+ require('cmp').mapping.scroll_docs(4)
+ end
+ '';
+ options.desc = "Scroll down by four lines";
+ }
+ ];
+
plugins.cmp = {
/*
TODO: integrate this:
@@ -43,13 +87,9 @@ in {
*/
enable = true;
autoEnableSources = true;
+
settings = {
- mapping = {
- # TODO: add support for desc and which key here
- "<C-d>" = "cmp.mapping.scroll_docs(-4)"; # desc = "Scroll up by four lines"
- "<C-f>" = "cmp.mapping.scroll_docs(4)"; # desc = "Scroll down by four lines"
- "HH" = "cmp.mapping.complete()"; # desc = "Confirm snipped"
- };
+ mapping = {};
snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";