mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-07 10:51:36 +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
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";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue