diff --git a/modules/notes/todo-comments/config.nix b/modules/notes/todo-comments/config.nix index 45a26bc..3adb0f6 100644 --- a/modules/notes/todo-comments/config.nix +++ b/modules/notes/todo-comments/config.nix @@ -7,17 +7,19 @@ with lib; with builtins; let cfg = config.vim.notes.todo-comments; + self = import ./todo-comments.nix {inherit lib;}; + mappings = self.options.vim.notes.todo-comments.mappings; in { config = mkIf (cfg.enable) { vim.startPlugins = [ "todo-comments" ]; - vim.maps.normal = { - "tdq" = {action = ":TodoQuickFix";}; - "tds" = {action = ":TodoTelescope";}; - "tdt" = {action = ":TodoTrouble";}; - }; + vim.maps.normal = mkMerge [ + (mkBinding cfg.mappings.quickFix ":TodoQuickFix" mappings.quickFix.description) + (mkIf config.vim.telescope.enable (mkBinding cfg.mappings.telescope ":TodoTelescope" mappings.telescope.description)) + (mkIf config.vim.lsp.trouble.enable (mkBinding cfg.mappings.trouble ":TodoTrouble" mappings.trouble.description)) + ]; vim.luaConfigRC.todo-comments = '' require('todo-comments').setup { diff --git a/modules/notes/todo-comments/todo-comments.nix b/modules/notes/todo-comments/todo-comments.nix index 3064e75..39b8aad 100644 --- a/modules/notes/todo-comments/todo-comments.nix +++ b/modules/notes/todo-comments/todo-comments.nix @@ -1,8 +1,4 @@ -{ - config, - lib, - ... -}: +{lib, ...}: with lib; with builtins; { options.vim.notes.todo-comments = { @@ -21,5 +17,11 @@ with builtins; { description = "ripgrep regex pattern used for searching comments"; }; }; + + mappings = { + quickFix = mkMappingOption "Open Todo-s in a quickfix list" "tdq"; + telescope = mkMappingOption "Open Todo-s in telescope" "tds"; + trouble = mkMappingOption "Open Todo-s in Trouble" "tdt"; + }; }; }