mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-02-04 10:55:50 +00:00
feat(todo-comments): custom setup
This commit is contained in:
parent
2feaadc266
commit
3f4ef987dd
2 changed files with 45 additions and 38 deletions
|
|
@ -1,22 +1,50 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) str;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkOption types mkMappingOption mkRenamedOptionModule;
|
||||
in {
|
||||
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"])
|
||||
];
|
||||
|
||||
options.vim.notes.todo-comments = {
|
||||
enable = mkEnableOption "todo-comments: highlight and search for todo comments like TODO, HACK, BUG in your code base";
|
||||
|
||||
patterns = {
|
||||
highlight = mkOption {
|
||||
type = str;
|
||||
default = ''[[.*<(KEYWORDS)(\([^\)]*\))?:]]'';
|
||||
description = "vim regex pattern used for highlighting comments";
|
||||
setupOpts = lib.nvim.types.mkPluginSetupOption "todo-comments.nvim" {
|
||||
highlight = {
|
||||
pattern = mkOption {
|
||||
type = types.str;
|
||||
default = ''.*<(KEYWORDS)(\([^\)]*\))?:'';
|
||||
description = "vim regex pattern used for highlighting comments";
|
||||
};
|
||||
};
|
||||
|
||||
search = mkOption {
|
||||
type = str;
|
||||
default = ''[[\b(KEYWORDS)(\([^\)]*\))?:]]'';
|
||||
description = "ripgrep regex pattern used for searching comments";
|
||||
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";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue