nvf/modules/plugins/notes/todo-comments/todo-comments.nix

59 lines
1.8 KiB
Nix
Raw Normal View History

2024-02-17 21:28:12 +00:00
{
pkgs,
lib,
...
}: let
inherit (lib) mkEnableOption mkOption types mkRenamedOptionModule;
inherit (lib.nvim.binds) mkMappingOption;
in {
2024-02-17 21:28:12 +00:00
imports = let
renamedSetupOption = oldPath: newPath:
mkRenamedOptionModule
(["vim" "notes" "todo-comments"] ++ oldPath)
(["vim" "notes" "todo-comments" "setupOpts"] ++ newPath);
in [
(renamedSetupOption ["patterns" "highlight"] ["highlight" "pattern"])
(renamedSetupOption ["patterns" "search"] ["search" "pattern"])
];
2023-03-01 10:26:58 +00:00
options.vim.notes.todo-comments = {
enable = mkEnableOption "todo-comments: highlight and search for todo comments like TODO, HACK, BUG in your code base";
2023-03-01 10:26:58 +00:00
2024-02-17 21:28:12 +00:00
setupOpts = lib.nvim.types.mkPluginSetupOption "todo-comments.nvim" {
highlight = {
pattern = mkOption {
type = types.str;
default = ''.*<(KEYWORDS)(\([^\)]*\))?:'';
description = "vim regex pattern used for highlighting comments";
};
2023-03-01 10:26:58 +00:00
};
2024-02-17 21:28:12 +00:00
search = {
pattern = mkOption {
type = types.str;
default = ''\b(KEYWORDS)(\([^\)]*\))?:'';
description = "ripgrep regex pattern used for searching comments";
};
command = mkOption {
type = types.str;
default = "${pkgs.ripgrep}/bin/rg";
description = "search command";
};
args = mkOption {
type = types.listOf types.str;
default = ["--color=never" "--no-heading" "--with-filename" "--line-number" "--column"];
description = "arguments to pass to the search command";
};
2023-03-01 10:26:58 +00:00
};
};
2023-04-18 16:14:44 +00:00
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";
};
2023-03-01 10:26:58 +00:00
};
}