Merge pull request #29 from NotAShelf/feature/todo-comments.nvim

Feature/todo comments.nvim
This commit is contained in:
NotAShelf 2023-03-01 10:33:51 +00:00 committed by GitHub
commit cccc7f5bda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 84 additions and 0 deletions

View file

@ -147,6 +147,7 @@ inputs: let
obsidian.enable = false; # FIXME neovim fails to build if obsidian is enabled obsidian.enable = false; # FIXME neovim fails to build if obsidian is enabled
orgmode.enable = false; orgmode.enable = false;
mind-nvim.enable = true; mind-nvim.enable = true;
todo-comments.enable = true;
}; };
vim.terminal = { vim.terminal = {

View file

@ -71,6 +71,7 @@ with lib; let
"mind-nvim" "mind-nvim"
"fidget-nvim" "fidget-nvim"
"diffview-nvim" "diffview-nvim"
"todo-comments"
]; ];
# You can either use the name of the plugin or a package. # You can either use the name of the plugin or a package.
pluginsType = with types; listOf (nullOr (either (enum availablePlugins) package)); pluginsType = with types; listOf (nullOr (either (enum availablePlugins) package));

View file

@ -3,5 +3,6 @@ _: {
./obsidian ./obsidian
./orgmode ./orgmode
./mind-nvim ./mind-nvim
./todo-comments
]; ];
} }

View 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},
},
}
'';
};
}

View file

@ -0,0 +1,6 @@
_: {
imports = [
./todo-comments.nix
./config.nix
];
}

View 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";
};
};
};
}