about summary refs log tree commit diff stats
path: root/hm/soispha/conf/nvim/plgs
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-10-08 13:12:44 +0200
committerSoispha <soispha@vhack.eu>2023-10-08 13:12:44 +0200
commit8fbcfc8698f97fc4701d09cb3de3e095d5ddd7c7 (patch)
tree90530153a36e969569115c6e06ea17c473826670 /hm/soispha/conf/nvim/plgs
parentchore(version): v1.15.0 (diff)
downloadnixos-config-8fbcfc8698f97fc4701d09cb3de3e095d5ddd7c7.zip
fix(hm/conf/nvim): Update to new keymap format
Diffstat (limited to '')
-rw-r--r--hm/soispha/conf/nvim/plgs/comment-nvim/default.nix48
-rw-r--r--hm/soispha/conf/nvim/plgs/debugprint/default.nix119
-rw-r--r--hm/soispha/conf/nvim/plgs/femaco/default.nix18
-rw-r--r--hm/soispha/conf/nvim/plgs/goto-preview/default.nix44
-rw-r--r--hm/soispha/conf/nvim/plgs/harpoon/default.nix67
-rw-r--r--hm/soispha/conf/nvim/plgs/leap/default.nix57
-rw-r--r--hm/soispha/conf/nvim/plgs/lsp/keymaps/default.nix36
-rw-r--r--hm/soispha/conf/nvim/plgs/telescope/extensions/bibtex/default.nix12
-rw-r--r--hm/soispha/conf/nvim/plgs/telescope/extensions/frecency/default.nix18
-rw-r--r--hm/soispha/conf/nvim/plgs/telescope/extensions/symbols/default.nix90
10 files changed, 265 insertions, 244 deletions
diff --git a/hm/soispha/conf/nvim/plgs/comment-nvim/default.nix b/hm/soispha/conf/nvim/plgs/comment-nvim/default.nix
index cf99d3d5..b0d405f3 100644
--- a/hm/soispha/conf/nvim/plgs/comment-nvim/default.nix
+++ b/hm/soispha/conf/nvim/plgs/comment-nvim/default.nix
@@ -10,27 +10,31 @@
         extra = false;
       };
     };
-    maps = {
-      visual = {
-        "gcc" = {
-          action = "<Plug>(comment_toggle_linewise_visual)";
-          desc = "toggle the current line in a linewise comment";
-        };
-        "gbc" = {
-          action = "<Plug>(comment_toggle_blockwise_visual)";
-          desc = "toggle the current line in a blockwise comment";
-        };
-      };
-      normal = {
-        "gcc" = {
-          action = "<Plug>(comment_toggle_linewise_current)";
-          desc = "toggle the current line in a linewise comment";
-        };
-        "gbc" = {
-          action = "<Plug>(comment_toggle_blockwise_current)";
-          desc = "toggle the current line in a blockwise comment";
-        };
-      };
-    };
+    keymaps = [
+      {
+        key = "gcc";
+        mode = "v";
+        action = "<Plug>(comment_toggle_linewise_visual)";
+        options.desc = "toggle the current line in a linewise comment";
+      }
+      {
+        key = "gbc";
+        mode = "v";
+        action = "<Plug>(comment_toggle_blockwise_visual)";
+        options.desc = "toggle the current line in a blockwise comment";
+      }
+      {
+        key = "gcc";
+        mode = "n";
+        action = "<Plug>(comment_toggle_linewise_current)";
+        options.desc = "toggle the current line in a linewise comment";
+      }
+      {
+        key = "gbc";
+        mode = "n";
+        action = "<Plug>(comment_toggle_blockwise_current)";
+        options.desc = "toggle the current line in a blockwise comment";
+      }
+    ];
   };
 }
diff --git a/hm/soispha/conf/nvim/plgs/debugprint/default.nix b/hm/soispha/conf/nvim/plgs/debugprint/default.nix
index 522965ac..b0d72339 100644
--- a/hm/soispha/conf/nvim/plgs/debugprint/default.nix
+++ b/hm/soispha/conf/nvim/plgs/debugprint/default.nix
@@ -12,66 +12,63 @@
       pkgs.vimExtraPlugins.debugprint-nvim
     ];
 
-    maps = let
-      visualNormal = {
-        "g?v" = {
-          action = ''
-            function()
-              return require('debugprint').debugprint({variable = true;});
-            end
-          '';
-          lua = true;
-          expr = true;
-          desc = ''
-            'variable' debug line below the current line
-          '';
-        };
-        "g?V" = {
-          action = ''
-            function()
-              return require('debugprint').debugprint({above = true; variable = true;}) ;
-            end
-          '';
-          lua = true;
-          expr = true;
-          desc = ''
-            'variable' debug line above the current line
-          '';
-        };
-      };
-    in {
-      normal =
-        {
-          "g?p" = {
-            action = ''
-              function()
-                return require('debugprint').debugprint();
-              end
-            '';
-            lua = true;
-            expr = true;
-            desc = ''
-              'plain' debug line below the current line
-            '';
-          };
-          "g?P" = {
-            action = ''
-              function()
-                return require('debugprint').debugprint({above = true;});
-              end
-            '';
-            lua = true;
-            expr = true;
-            desc = ''
-              'plain' debug line above the current line
-            '';
-          };
-        }
-        // visualNormal;
-      visual =
-        {
-        }
-        // visualNormal;
-    };
+    keymaps = [
+      {
+        key = "g?v";
+        mode = ["v" "n"];
+        action = ''
+          function()
+            return require('debugprint').debugprint({variable = true;});
+          end
+        '';
+        lua = true;
+        options.expr = true;
+        options.desc = ''
+          'variable' debug line below the current line
+        '';
+      }
+      {
+        key = "g?V";
+        mode = ["v" "n"];
+        action = ''
+          function()
+            return require('debugprint').debugprint({above = true; variable = true;}) ;
+          end
+        '';
+        lua = true;
+        options.expr = true;
+        options.desc = ''
+          'variable' debug line above the current line
+        '';
+      }
+      {
+        key = "g?p";
+        mode = "n";
+        action = ''
+          function()
+            return require('debugprint').debugprint();
+          end
+        '';
+        lua = true;
+        options.expr = true;
+        options.desc = ''
+          'plain' debug line below the current line
+        '';
+      }
+      {
+        key = "g?P";
+        mode = "n";
+        action = ''
+          function()
+            return require('debugprint').debugprint({above = true;});
+          end
+        '';
+        lua = true;
+        options.expr = true;
+        options.desc = ''
+          'plain' debug line above the current line
+        '';
+      }
+    ];
   };
 }
diff --git a/hm/soispha/conf/nvim/plgs/femaco/default.nix b/hm/soispha/conf/nvim/plgs/femaco/default.nix
index 570ff297..be8723ce 100644
--- a/hm/soispha/conf/nvim/plgs/femaco/default.nix
+++ b/hm/soispha/conf/nvim/plgs/femaco/default.nix
@@ -11,14 +11,14 @@
     extraPlugins = [
       pkgs.vimExtraPlugins.nvim-FeMaco-lua
     ];
-    maps = {
-      normal = {
-        "<leader>cc" = {
-          action = "require('femaco.edit').edit_code_block";
-          lua = true;
-          desc = "edit a [c]ode blo[c]k with femaco";
-        };
-      };
-    };
+    keymaps = [
+      {
+        key = "<leader>cc";
+        mode = "n";
+        action = "require('femaco.edit').edit_code_block";
+        lua = true;
+        options.desc = "edit a [c]ode blo[c]k with femaco";
+      }
+    ];
   };
 }
diff --git a/hm/soispha/conf/nvim/plgs/goto-preview/default.nix b/hm/soispha/conf/nvim/plgs/goto-preview/default.nix
index 740bb04c..70527b93 100644
--- a/hm/soispha/conf/nvim/plgs/goto-preview/default.nix
+++ b/hm/soispha/conf/nvim/plgs/goto-preview/default.nix
@@ -11,32 +11,42 @@
     extraPlugins = [
       pkgs.vimExtraPlugins.goto-preview
     ];
-    maps.normal = {
-      "<space>gd" = {
+    keymaps = [
+      {
+        key = "<space>gd";
+        mode = "n";
         action = "require('goto-preview').goto_preview_definition";
         lua = true;
-        desc = "[G]oto [D]efinition";
-      };
-      "<space>gtd" = {
+        options.desc = "[G]oto [D]efinition";
+      }
+      {
+        key = "<space>gtd";
+        mode = "n";
         action = "require('goto-preview').goto_preview_type_definition";
         lua = true;
-        desc = "[G]oto the [t]ype [D]efinition";
-      };
-      "<space>gi" = {
+        options.desc = "[G]oto the [t]ype [D]efinition";
+      }
+      {
+        key = "<space>gi";
+        mode = "n";
         action = "require('goto-preview').goto_preview_implementation";
         lua = true;
-        desc = "[G]oto [I]mplementations";
-      };
-      "<space>gr" = {
+        options.desc = "[G]oto [I]mplementations";
+      }
+      {
+        key = "<space>gr";
+        mode = "n";
         action = "require('goto-preview').goto_preview_references";
         lua = true;
-        desc = "[G]o to all [R]eferences of the symbol";
-      };
-      "\\<space>" = {
+        options.desc = "[G]o to all [R]eferences of the symbol";
+      }
+      {
+        key = "\\<space>";
+        mode = "n";
         action = "require('goto-preview').close_all_win";
         lua = true;
-        desc = "close all preview windows";
-      };
-    };
+        options.desc = "close all preview windows";
+      }
+    ];
   };
 }
diff --git a/hm/soispha/conf/nvim/plgs/harpoon/default.nix b/hm/soispha/conf/nvim/plgs/harpoon/default.nix
index ecd1d6cb..76f33af8 100644
--- a/hm/soispha/conf/nvim/plgs/harpoon/default.nix
+++ b/hm/soispha/conf/nvim/plgs/harpoon/default.nix
@@ -6,16 +6,14 @@
     number,
     desc_template,
   }: {
-    name = "${prefix}${number}";
-    value = {
-      action = ''
-        function()
-          ${command_template number}
-        end
-      '';
-      lua = true;
-      desc = "${desc_template number}";
-    };
+    key = "${prefix}${number}";
+    action = ''
+      function()
+        ${command_template number}
+      end
+    '';
+    lua = true;
+    options.desc = "${desc_template number}";
   };
   mkGotoTerminalCommand = number: let
     desc_template = number: "Goto terminal number ${number}";
@@ -30,8 +28,8 @@
   in
     mkNumberedCommand {inherit desc_template command_template prefix number;};
 
-  gotoTerminalMappings = builtins.listToAttrs (builtins.map mkGotoTerminalCommand numbers);
-  gotoFileMappings = builtins.listToAttrs (builtins.map mkGotoFileCommand numbers);
+  gotoTerminalMappings = builtins.map mkGotoTerminalCommand numbers;
+  gotoFileMappings = builtins.map mkGotoFileCommand numbers;
 in {
   programs.nixvim = {
     plugins.harpoon = {
@@ -41,55 +39,60 @@ in {
         tmuxGotoTerminal = null; # TODO:
       };
     };
-    maps.normalVisualOp =
-      {
-        "-" = {
+    keymaps =
+      [
+        {
+          key = "-";
           action = ''
             function()
               require("harpoon.ui").nav_next()
              end
           '';
           lua = true;
-          desc = "go to the next marked file";
-        };
-        "_" = {
+          options.desc = "go to the next marked file";
+        }
+        {
+          key = "_";
           action = ''
             function()
               require("harpoon.ui").nav_prev()
              end
           '';
           lua = true;
-          desc = "go to the previous marked file";
-        };
-        "<leader><leader>" = {
+          options.desc = "go to the previous marked file";
+        }
+        {
+          key = "<leader><leader>";
           action = ''
             function()
               require("harpoon.mark").add_file()
             end
           '';
           lua = true;
-          desc = "add a mark to the open file in harpoon.";
-        };
-        "gqc" = {
+          options.desc = "add a mark to the open file in harpoon.";
+        }
+        {
+          key = "gqc";
           action = ''
             function()
               require("harpoon.cmd-ui").toggle_quick_menu()
             end
           '';
           lua = true;
-          desc = "toggle the harpoon command quick menu to see all commands.";
-        };
-        "<leader>q" = {
+          options.desc = "toggle the harpoon command quick menu to see all commands.";
+        }
+        {
+          key = "<leader>q";
           action = ''
             function()
               require("harpoon.ui").toggle_quick_menu()
             end
           '';
           lua = true;
-          desc = "toggle the harpoon normal quick menu to see all marks.";
-        };
-      }
-      // gotoFileMappings
-      // gotoTerminalMappings;
+          options.desc = "toggle the harpoon normal quick menu to see all marks.";
+        }
+      ]
+      ++ gotoFileMappings
+      ++ gotoTerminalMappings;
   };
 }
diff --git a/hm/soispha/conf/nvim/plgs/leap/default.nix b/hm/soispha/conf/nvim/plgs/leap/default.nix
index bffdf33c..568dcec0 100644
--- a/hm/soispha/conf/nvim/plgs/leap/default.nix
+++ b/hm/soispha/conf/nvim/plgs/leap/default.nix
@@ -26,33 +26,34 @@
         "Z"
       ];
     };
-    maps = {
-      normalVisualOp = {
-        "m" = {
-          action = "<Plug>(leap-forward-to)";
-          desc = "leap forward to";
-        };
-        "M" = {
-          action = "<Plug>(leap-backward-to)";
-          desc = "leap backward to";
-        };
-        "gs" = {
-          action = "<Plug>(leap-from-window)";
-          desc = "leap to enterable windows";
-        };
-      };
-      visual = {
-        /*
-        "x" = {
-          action = "<Plug>(leap-forward-till)";
-          desc = "leap forward till";
-        };
-        "X" = {
-          action = "<Plug>(leap-backward-till)";
-          desc = "leap backward till";
-        };
-        */
-      };
-    };
+    keymaps = [
+      {
+        key = "m";
+        action = "<Plug>(leap-forward-to)";
+        options.desc = "leap forward to";
+      }
+      {
+        key = "M";
+        action = "<Plug>(leap-backward-to)";
+        options.desc = "leap backward to";
+      }
+      {
+        key = "gs";
+        action = "<Plug>(leap-from-window)";
+        options.desc = "leap to enterable windows";
+      }
+      /*
+            {key= "x";
+              mode = "v";
+              action = "<Plug>(leap-forward-till)";
+      options.desc = "leap forward till";
+            }
+            {key= "X";
+              mode = "v";
+              action = "<Plug>(leap-backward-till)";
+      options.desc = "leap backward till";
+            }
+      */
+    ];
   };
 }
diff --git a/hm/soispha/conf/nvim/plgs/lsp/keymaps/default.nix b/hm/soispha/conf/nvim/plgs/lsp/keymaps/default.nix
index 4017521d..e176461e 100644
--- a/hm/soispha/conf/nvim/plgs/lsp/keymaps/default.nix
+++ b/hm/soispha/conf/nvim/plgs/lsp/keymaps/default.nix
@@ -50,23 +50,23 @@
         };
       };
     };
-    maps = {
-      normal = {
-        "<space>f" = {
-          action = "function() vim.lsp.buf.format { async = true } end";
-          lua = true;
-          desc = "[F]ormat the current buffer (asynchronously)";
-        };
-        "<space>wl" = {
-          action = ''
-            function()
-              print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
-            end
-          '';
-          lua = true;
-          desc = "[W]orkspace folders [l]ist";
-        };
-      };
-    };
+    keymaps = [
+      {
+        key = "<space>f";
+        action = "function() vim.lsp.buf.format { async = true } end";
+        lua = true;
+        options.desc = "[F]ormat the current buffer (asynchronously)";
+      }
+      {
+        key = "<space>wl";
+        action = ''
+          function()
+            print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
+          end
+        '';
+        lua = true;
+        options.desc = "[W]orkspace folders [l]ist";
+      }
+    ];
   };
 }
diff --git a/hm/soispha/conf/nvim/plgs/telescope/extensions/bibtex/default.nix b/hm/soispha/conf/nvim/plgs/telescope/extensions/bibtex/default.nix
index 12c9736c..946d32f1 100644
--- a/hm/soispha/conf/nvim/plgs/telescope/extensions/bibtex/default.nix
+++ b/hm/soispha/conf/nvim/plgs/telescope/extensions/bibtex/default.nix
@@ -4,10 +4,12 @@
     extraPlugins = [
       pkgs.vimExtraPlugins.telescope-bibtex-nvim
     ];
-    maps.normal = {
-      "<space>ib" = {
-        desc = "[i]nsert a [b]atex citation";
-      };
-    };
+    keymaps = [
+      {
+        key = "<space>ib";
+        mode = "n";
+        options.desc = "[i]nsert a [b]atex citation";
+      }
+    ];
   };
 }
diff --git a/hm/soispha/conf/nvim/plgs/telescope/extensions/frecency/default.nix b/hm/soispha/conf/nvim/plgs/telescope/extensions/frecency/default.nix
index 4a4c22be..b236f3c5 100644
--- a/hm/soispha/conf/nvim/plgs/telescope/extensions/frecency/default.nix
+++ b/hm/soispha/conf/nvim/plgs/telescope/extensions/frecency/default.nix
@@ -1,14 +1,14 @@
 {...}: {
   programs.nixvim = {
-    maps = {
-      normal = {
-        "gff" = {
-          action = "function() require('telescope').extensions.frecency.frecency() end";
-          lua = true;
-          desc = "activate the frecency file selection";
-        };
-      };
-    };
+    keymaps = [
+      {
+        key = "gff";
+        mode = "n";
+        action = "function() require('telescope').extensions.frecency.frecency() end";
+        lua = true;
+        options.desc = "activate the frecency file selection";
+      }
+    ];
     plugins.telescope = {
       extensions.frecency = {
         enable = true;
diff --git a/hm/soispha/conf/nvim/plgs/telescope/extensions/symbols/default.nix b/hm/soispha/conf/nvim/plgs/telescope/extensions/symbols/default.nix
index fe38f8c1..fa166c02 100644
--- a/hm/soispha/conf/nvim/plgs/telescope/extensions/symbols/default.nix
+++ b/hm/soispha/conf/nvim/plgs/telescope/extensions/symbols/default.nix
@@ -4,48 +4,52 @@
       # Source of symbols for telescope symbols
       pkgs.vimPlugins.telescope-symbols-nvim
     ];
-    maps = {
-      normal = {
-        "<space>il" = {
-          action = ''
-            function()
-              require('telescope.builtin').symbols{ sources = {
-                'latex'
-              }}
-            end
-          '';
-          lua = true;
-          desc = "[i]nsert a [l]atex symbol";
-        };
-        "<space>ie" = {
-          action = ''
-            function()
-              require('telescope.builtin').symbols{ sources = {
-                  'emoji',
-              }}
-            end
-          '';
-          lua = true;
-          desc = "[i]nsert a [e]moji";
-        };
-        "<space>is" = {
-          action = ''
-            function()
-              require('telescope.builtin').symbols{ sources = {
-                  'emoji',
-                  'gitmoji',
-                  'julia',
-                  'kaomoji',
-                  'latex',
-                  'math',
-                  'nerd',
-              }}
-            end
-          '';
-          lua = true;
-          desc = "[i]nsert a [s]ymbol (like emojis)";
-        };
-      };
-    };
+    keymaps = [
+      {
+        key = "<space>il";
+        mode = "n";
+        action = ''
+          function()
+            require('telescope.builtin').symbols{ sources = {
+              'latex'
+            }}
+          end
+        '';
+        lua = true;
+        options.desc = "[i]nsert a [l]atex symbol";
+      }
+      {
+        key = "<space>ie";
+        mode = "n";
+        action = ''
+          function()
+            require('telescope.builtin').symbols{ sources = {
+                'emoji',
+            }}
+          end
+        '';
+        lua = true;
+        options.desc = "[i]nsert a [e]moji";
+      }
+      {
+        key = "<space>is";
+        mode = "n";
+        action = ''
+          function()
+            require('telescope.builtin').symbols{ sources = {
+                'emoji',
+                'gitmoji',
+                'julia',
+                'kaomoji',
+                'latex',
+                'math',
+                'nerd',
+            }}
+          end
+        '';
+        lua = true;
+        options.desc = "[i]nsert a [s]ymbol (like emojis)";
+      }
+    ];
   };
 }