mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-07 12:45:57 +01:00
feat: add todo-comments options
This commit is contained in:
parent
e03c5a6878
commit
1c66c6ff65
4 changed files with 82 additions and 0 deletions
|
@ -3,5 +3,6 @@ _: {
|
|||
./obsidian
|
||||
./orgmode
|
||||
./mind-nvim
|
||||
./todo-comments
|
||||
];
|
||||
}
|
||||
|
|
47
modules/notes/todo-comments/config.nix
Normal file
47
modules/notes/todo-comments/config.nix
Normal file
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with builtins; let
|
||||
cfg = config.vim.notes.todo-comments;
|
||||
in {
|
||||
config = mkIf (cfg.enable) {
|
||||
vim.startPlugins = [
|
||||
"todo-comments"
|
||||
];
|
||||
|
||||
vim.nnoremap = {
|
||||
"<leader>tdq" = ":TodoQuickFix<CR>";
|
||||
"<leader>tds" = ":TodoTelescope<CR>";
|
||||
"<leader>tdt" = ":TodoTrouble<CR>";
|
||||
};
|
||||
|
||||
vim.luaConfigRC.todo-comments = ''
|
||||
require('todo-comments').setup {
|
||||
highlight = {
|
||||
before = "", -- "fg" or "bg" or empty
|
||||
keyword = "bg", -- "fg", "bg", "wide" or empty
|
||||
after = "fg", -- "fg" or "bg" or empty
|
||||
pattern = ${cfg.patterns.highlight},
|
||||
comments_only = true, -- uses treesitter to match keywords in comments only
|
||||
max_line_len = 400, -- ignore lines longer than this
|
||||
exclude = {}, -- list of file types to exclude highlighting
|
||||
},
|
||||
search = {
|
||||
command = "${pkgs.ripgrep}/bin/rg",
|
||||
args = {
|
||||
"--color=never",
|
||||
"--no-heading",
|
||||
"--with-filename",
|
||||
"--line-number",
|
||||
"--column",
|
||||
},
|
||||
pattern = ${cfg.patterns.search},
|
||||
},
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
6
modules/notes/todo-comments/default.nix
Normal file
6
modules/notes/todo-comments/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./todo-comments.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
28
modules/notes/todo-comments/todo-comments.nix
Normal file
28
modules/notes/todo-comments/todo-comments.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with builtins; let
|
||||
cfg = config.vim.notes.todo-comments;
|
||||
in {
|
||||
options.vim.notes.todo-comments = {
|
||||
enable = mkEnableOption "todo-comments";
|
||||
|
||||
patterns = {
|
||||
highlight = mkOption {
|
||||
type = types.str;
|
||||
default = ''[[.*<(KEYWORDS)(\([^\)]*\))?:]]'';
|
||||
description = "vim regex pattern used for highlighting comments";
|
||||
};
|
||||
|
||||
search = mkOption {
|
||||
type = types.str;
|
||||
default = ''[[\b(KEYWORDS)(\([^\)]*\))?:]]'';
|
||||
description = "ripgrep regex pattern used for searching comments";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue