mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 10:21:31 +00:00
treewide: begin restructuring the module tree
This commit is contained in:
parent
e1835f6c46
commit
7c730a78e5
254 changed files with 749 additions and 664 deletions
31
modules/plugins/notes/todo-comments/config.nix
Normal file
31
modules/plugins/notes/todo-comments/config.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkMerge mkBinding mkIf;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.notes.todo-comments;
|
||||
self = import ./todo-comments.nix {inherit pkgs lib;};
|
||||
inherit (self.options.vim.notes.todo-comments) mappings;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [
|
||||
"todo-comments"
|
||||
];
|
||||
|
||||
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))
|
||||
];
|
||||
|
||||
luaConfigRC.todo-comments = ''
|
||||
require('todo-comments').setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/notes/todo-comments/default.nix
Normal file
6
modules/plugins/notes/todo-comments/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./todo-comments.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
57
modules/plugins/notes/todo-comments/todo-comments.nix
Normal file
57
modules/plugins/notes/todo-comments/todo-comments.nix
Normal file
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
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";
|
||||
|
||||
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 = {
|
||||
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";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
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";
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue