mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-08 03:11:36 +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
|
@ -3,45 +3,49 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf nvim pushDownDefault;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.binds) pushDownDefault;
|
||||
|
||||
cfg = config.vim.notes.obsidian;
|
||||
auto = config.vim.autocomplete;
|
||||
in {
|
||||
config = mkIf (cfg.enable) {
|
||||
vim.startPlugins = [
|
||||
"obsidian-nvim"
|
||||
"vim-markdown"
|
||||
"tabular"
|
||||
];
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [
|
||||
"obsidian-nvim"
|
||||
"vim-markdown"
|
||||
"tabular"
|
||||
];
|
||||
|
||||
vim.binds.whichKey.register = pushDownDefault {
|
||||
"<leader>o" = "+Notes";
|
||||
};
|
||||
binds.whichKey.register = pushDownDefault {
|
||||
"<leader>o" = "+Notes";
|
||||
};
|
||||
|
||||
vim.luaConfigRC.obsidian = nvim.dag.entryAnywhere ''
|
||||
require("obsidian").setup({
|
||||
dir = "${cfg.dir}",
|
||||
completion = {
|
||||
nvim_cmp = ${
|
||||
if (auto.type == "nvim-cmp")
|
||||
then "true"
|
||||
else "false"
|
||||
}
|
||||
},
|
||||
daily_notes = {
|
||||
folder = ${
|
||||
if (cfg.daily-notes.folder == "")
|
||||
then "nil,"
|
||||
else "'${cfg.daily-notes.folder}',"
|
||||
}
|
||||
date_format = ${
|
||||
if (cfg.daily-notes.date-format == "")
|
||||
then "nil,"
|
||||
else "'${cfg.daily-notes.date-format}',"
|
||||
}
|
||||
luaConfigRC.obsidian = entryAnywhere ''
|
||||
require("obsidian").setup({
|
||||
dir = "${cfg.dir}",
|
||||
completion = {
|
||||
nvim_cmp = ${
|
||||
if (auto.type == "nvim-cmp")
|
||||
then "true"
|
||||
else "false"
|
||||
}
|
||||
})
|
||||
'';
|
||||
},
|
||||
daily_notes = {
|
||||
folder = ${
|
||||
if (cfg.daily-notes.folder == "")
|
||||
then "nil,"
|
||||
else "'${cfg.daily-notes.folder}',"
|
||||
}
|
||||
date_format = ${
|
||||
if (cfg.daily-notes.date-format == "")
|
||||
then "nil,"
|
||||
else "'${cfg.daily-notes.date-format}',"
|
||||
}
|
||||
}
|
||||
})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
_: {
|
||||
{
|
||||
imports = [
|
||||
./obsidian.nix
|
||||
./config.nix
|
||||
|
|
|
@ -1,27 +1,24 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkOption types;
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) str bool;
|
||||
in {
|
||||
options.vim.notes = {
|
||||
obsidian = {
|
||||
enable = mkEnableOption "complementary neovim plugins for Obsidian editor";
|
||||
dir = mkOption {
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = "~/my-vault";
|
||||
description = "Obsidian vault directory";
|
||||
};
|
||||
|
||||
daily-notes = {
|
||||
folder = mkOption {
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = "";
|
||||
description = "Directory in which daily notes should be created";
|
||||
};
|
||||
date-format = mkOption {
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = "";
|
||||
description = "Date format used for creating daily notes";
|
||||
};
|
||||
|
@ -29,8 +26,7 @@ in {
|
|||
|
||||
completion = {
|
||||
nvim_cmp = mkOption {
|
||||
# if using nvim-cmp, otherwise set to false
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
description = "If using nvim-cmp, otherwise set to false";
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue