neovim-flake/modules/plugins/notes/obsidian/obsidian.nix

58 lines
1.7 KiB
Nix
Raw Normal View History

2024-02-17 16:30:26 +01:00
{
config,
lib,
...
}: let
2024-04-19 21:28:07 +02:00
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) bool str nullOr;
inherit (lib.modules) mkRenamedOptionModule;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
2024-02-17 16:30:26 +01:00
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";
2024-04-19 21:28:07 +02:00
setupOpts = mkPluginSetupOption "Obsidian.nvim" {
2024-02-17 16:30:26 +01:00
dir = mkOption {
2024-04-19 21:28:07 +02:00
type = str;
2024-02-17 16:30:26 +01:00
default = "~/my-vault";
description = "Obsidian vault directory";
};
2024-02-17 16:30:26 +01:00
daily_notes = {
folder = mkOption {
2024-04-19 21:28:07 +02:00
type = nullOr str;
2024-02-17 16:30:26 +01:00
default = null;
description = "Directory in which daily notes should be created";
};
date_format = mkOption {
2024-04-19 21:28:07 +02:00
type = nullOr str;
2024-02-17 16:30:26 +01:00
default = null;
description = "Date format used for creating daily notes";
};
};
2024-02-17 16:30:26 +01:00
completion = {
nvim_cmp = mkOption {
# if using nvim-cmp, otherwise set to false
2024-04-19 21:28:07 +02:00
type = bool;
2024-02-17 16:30:26 +01:00
description = "If using nvim-cmp, otherwise set to false";
default = config.vim.autocomplete.type == "nvim-cmp";
};
};
};
};
};
}