mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-07 19:01:35 +00:00
modules/notes: switch to explicit lib calls
This commit is contained in:
parent
f6db808bfc
commit
2101ac9061
13 changed files with 154 additions and 144 deletions
|
@ -4,46 +4,49 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkMerge mkBinding mkIf;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.binds) mkBinding;
|
||||
|
||||
cfg = config.vim.notes.todo-comments;
|
||||
self = import ./todo-comments.nix {inherit lib;};
|
||||
mappings = self.options.vim.notes.todo-comments.mappings;
|
||||
inherit (self.options.vim.notes.todo-comments) mappings;
|
||||
in {
|
||||
config = mkIf (cfg.enable) {
|
||||
vim.startPlugins = [
|
||||
"todo-comments"
|
||||
];
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [
|
||||
"todo-comments"
|
||||
];
|
||||
|
||||
vim.maps.normal = mkMerge [
|
||||
(mkBinding cfg.mappings.quickFix ":TodoQuickFix<CR>" mappings.quickFix.description)
|
||||
(mkIf config.vim.telescope.enable (mkBinding cfg.mappings.telescope ":TodoTelescope<CR>" mappings.telescope.description))
|
||||
(mkIf config.vim.lsp.trouble.enable (mkBinding cfg.mappings.trouble ":TodoTrouble<CR>" mappings.trouble.description))
|
||||
];
|
||||
maps.normal = mkMerge [
|
||||
(mkBinding cfg.mappings.quickFix ":TodoQuickFix<CR>" mappings.quickFix.description)
|
||||
(mkIf config.vim.telescope.enable (mkBinding cfg.mappings.telescope ":TodoTelescope<CR>" mappings.telescope.description))
|
||||
(mkIf config.vim.lsp.trouble.enable (mkBinding cfg.mappings.trouble ":TodoTrouble<CR>" mappings.trouble.description))
|
||||
];
|
||||
|
||||
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",
|
||||
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
|
||||
},
|
||||
pattern = ${cfg.patterns.search},
|
||||
},
|
||||
}
|
||||
'';
|
||||
search = {
|
||||
command = "${pkgs.ripgrep}/bin/rg",
|
||||
args = {
|
||||
"--color=never",
|
||||
"--no-heading",
|
||||
"--with-filename",
|
||||
"--line-number",
|
||||
"--column",
|
||||
},
|
||||
pattern = ${cfg.patterns.search},
|
||||
},
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
_: {
|
||||
{
|
||||
imports = [
|
||||
./todo-comments.nix
|
||||
./config.nix
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib) mkEnableOption mkOption types mkMappingOption;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) str;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
in {
|
||||
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 = types.str;
|
||||
type = str;
|
||||
default = ''[[.*<(KEYWORDS)(\([^\)]*\))?:]]'';
|
||||
description = "vim regex pattern used for highlighting comments";
|
||||
};
|
||||
|
||||
search = mkOption {
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = ''[[\b(KEYWORDS)(\([^\)]*\))?:]]'';
|
||||
description = "ripgrep regex pattern used for searching comments";
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue