feat: add todo-comments keybindings

This commit is contained in:
n3oney 2023-04-18 18:14:44 +02:00
parent bdff97103d
commit 586a7f5b41
No known key found for this signature in database
GPG key ID: C786693DE727850E
2 changed files with 14 additions and 10 deletions

View file

@ -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 = {
"<leader>tdq" = {action = ":TodoQuickFix<CR>";};
"<leader>tds" = {action = ":TodoTelescope<CR>";};
"<leader>tdt" = {action = ":TodoTrouble<CR>";};
};
vim.maps.normal = mkMerge [
(mkBinding cfg.mappings.quickFix ":TodoQuickFix<CR>" mappings.quickFix.description)
(mkIf config.vim.telescope.enable (mkBinding cfg.mappings.telescope ":TodoTelescope<CR>" mappings.telescope.description))
(mkIf config.vim.lsp.trouble.enable (mkBinding cfg.mappings.trouble ":TodoTrouble<CR>" mappings.trouble.description))
];
vim.luaConfigRC.todo-comments = ''
require('todo-comments').setup {

View file

@ -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" "<leader>tdq";
telescope = mkMappingOption "Open Todo-s in telescope" "<leader>tds";
trouble = mkMappingOption "Open Todo-s in Trouble" "<leader>tdt";
};
};
}