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
8
modules/plugins/notes/default.nix
Normal file
8
modules/plugins/notes/default.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
imports = [
|
||||
./obsidian
|
||||
./orgmode
|
||||
./mind-nvim
|
||||
./todo-comments
|
||||
];
|
||||
}
|
33
modules/plugins/notes/mind-nvim/config.nix
Normal file
33
modules/plugins/notes/mind-nvim/config.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.binds) pushDownDefault;
|
||||
|
||||
cfg = config.vim.notes.mind-nvim;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [
|
||||
"mind-nvim"
|
||||
];
|
||||
|
||||
maps.normal = {
|
||||
"<leader>om" = {action = ":MindOpenMain<CR>";};
|
||||
"<leader>op" = {action = ":MindOpenProject<CR>";};
|
||||
"<leader>oc" = {action = ":MindClose<CR>";};
|
||||
};
|
||||
|
||||
binds.whichKey.register = pushDownDefault {
|
||||
"<leader>o" = "+Notes";
|
||||
};
|
||||
|
||||
luaConfigRC.mind-nvim = entryAnywhere ''
|
||||
require'mind'.setup()
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/notes/mind-nvim/default.nix
Normal file
6
modules/plugins/notes/mind-nvim/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./mind-nvim.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
7
modules/plugins/notes/mind-nvim/mind-nvim.nix
Normal file
7
modules/plugins/notes/mind-nvim/mind-nvim.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
in {
|
||||
options.vim.notes.mind-nvim = {
|
||||
enable = mkEnableOption "note organizer tool for Neovim [mind-nvim]";
|
||||
};
|
||||
}
|
30
modules/plugins/notes/obsidian/config.nix
Normal file
30
modules/plugins/notes/obsidian/config.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.binds) pushDownDefault;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.notes.obsidian;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [
|
||||
"obsidian-nvim"
|
||||
"vim-markdown"
|
||||
"tabular"
|
||||
];
|
||||
|
||||
binds.whichKey.register = pushDownDefault {
|
||||
"<leader>o" = "+Notes";
|
||||
};
|
||||
|
||||
luaConfigRC.obsidian = entryAnywhere ''
|
||||
require("obsidian").setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/notes/obsidian/default.nix
Normal file
6
modules/plugins/notes/obsidian/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./obsidian.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
54
modules/plugins/notes/obsidian/obsidian.nix
Normal file
54
modules/plugins/notes/obsidian/obsidian.nix
Normal file
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkOption types mkRenamedOptionModule;
|
||||
in {
|
||||
imports = let
|
||||
renamedSetupOption = oldPath: newPath:
|
||||
mkRenamedOptionModule
|
||||
(["vim" "notes" "obsidian"] ++ oldPath)
|
||||
(["vim" "notes" "obsidian" "setupOpts"] ++ newPath);
|
||||
in [
|
||||
(renamedSetupOption ["dir"] ["dir"])
|
||||
(renamedSetupOption ["daily-notes" "folder"] ["daily_notes" "folder"])
|
||||
(renamedSetupOption ["daily-notes" "date-format"] ["daily_notes" "date_format"])
|
||||
(renamedSetupOption ["completion"] ["completion"])
|
||||
];
|
||||
options.vim.notes = {
|
||||
obsidian = {
|
||||
enable = mkEnableOption "complementary neovim plugins for Obsidian editor";
|
||||
|
||||
setupOpts = lib.nvim.types.mkPluginSetupOption "Obsidian.nvim" {
|
||||
dir = mkOption {
|
||||
type = types.str;
|
||||
default = "~/my-vault";
|
||||
description = "Obsidian vault directory";
|
||||
};
|
||||
|
||||
daily_notes = {
|
||||
folder = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "Directory in which daily notes should be created";
|
||||
};
|
||||
date_format = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "Date format used for creating daily notes";
|
||||
};
|
||||
};
|
||||
|
||||
completion = {
|
||||
nvim_cmp = mkOption {
|
||||
# if using nvim-cmp, otherwise set to false
|
||||
type = types.bool;
|
||||
description = "If using nvim-cmp, otherwise set to false";
|
||||
default = config.vim.autocomplete.type == "nvim-cmp";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
52
modules/plugins/notes/orgmode/config.nix
Normal file
52
modules/plugins/notes/orgmode/config.nix
Normal file
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.binds) pushDownDefault;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.notes.orgmode;
|
||||
in {
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
vim = {
|
||||
startPlugins = [
|
||||
"orgmode-nvim"
|
||||
];
|
||||
|
||||
binds.whichKey.register = pushDownDefault {
|
||||
"<leader>o" = "+Notes";
|
||||
};
|
||||
|
||||
luaConfigRC.orgmode = entryAnywhere ''
|
||||
-- Load custom treesitter grammar for org filetype
|
||||
require('orgmode').setup_ts_grammar()
|
||||
|
||||
-- Treesitter configuration
|
||||
require('nvim-treesitter.configs').setup {
|
||||
|
||||
-- If TS highlights are not enabled at all, or disabled via `disable` prop,
|
||||
-- highlighting will fallback to default Vim syntax highlighting
|
||||
highlight = {
|
||||
enable = true,
|
||||
-- Required for spellcheck, some LaTex highlights and
|
||||
-- code block highlights that do not have ts grammar
|
||||
additional_vim_regex_highlighting = {'org'},
|
||||
},
|
||||
}
|
||||
|
||||
require('orgmode').setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
|
||||
vim.treesitter.grammars = [cfg.treesitter.orgPackage];
|
||||
})
|
||||
]);
|
||||
}
|
6
modules/plugins/notes/orgmode/default.nix
Normal file
6
modules/plugins/notes/orgmode/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./orgmode.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
39
modules/plugins/notes/orgmode/orgmode.nix
Normal file
39
modules/plugins/notes/orgmode/orgmode.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkRenamedOptionModule;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) str listOf;
|
||||
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption;
|
||||
in {
|
||||
imports = [
|
||||
(mkRenamedOptionModule ["vim" "notes" "orgmode" "orgAgendaFiles"] ["vim" "notes" "orgmode" "setupOpts" "org_agenda_files"])
|
||||
(mkRenamedOptionModule ["vim" "notes" "orgmode" "orgDefaultNotesFile"] ["vim" "notes" "orgmode" "setupOpts" "org_default_notes_file"])
|
||||
];
|
||||
|
||||
options.vim.notes.orgmode = {
|
||||
enable = mkEnableOption "nvim-orgmode: Neovim plugin for Emac Orgmode. Get the best of both worlds";
|
||||
|
||||
setupOpts = mkPluginSetupOption "Orgmode" {
|
||||
org_agenda_files = mkOption {
|
||||
type = listOf str;
|
||||
default = ["~/Documents/org/*" "~/my-orgs/**/*"];
|
||||
description = "List of org files to be used as agenda files.";
|
||||
};
|
||||
|
||||
org_default_notes_file = mkOption {
|
||||
type = str;
|
||||
default = "~/Documents/org/refile.org";
|
||||
description = "Default org file to be used for notes.";
|
||||
};
|
||||
};
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "Orgmode treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
orgPackage = mkGrammarOption pkgs "org";
|
||||
};
|
||||
};
|
||||
}
|
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