neovim-flake/modules/plugins/notes/todo-comments/todo-comments.nix

62 lines
1.9 KiB
Nix
Raw Normal View History

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