about summary refs log tree commit diff stats
path: root/modules/by-name/nv/nvim/plgs
diff options
context:
space:
mode:
Diffstat (limited to 'modules/by-name/nv/nvim/plgs')
-rw-r--r--modules/by-name/nv/nvim/plgs/nvim-cmp/default.nix52
1 files changed, 46 insertions, 6 deletions
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";