feat(orgmode): custom setup

This commit is contained in:
Ching Pei Yang 2024-02-17 16:46:16 +01:00
parent e5fba51877
commit 2feaadc266
2 changed files with 22 additions and 16 deletions

View file

@ -6,6 +6,7 @@
inherit (lib.modules) mkIf mkMerge; inherit (lib.modules) mkIf mkMerge;
inherit (lib.nvim.dag) entryAnywhere; inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.binds) pushDownDefault; inherit (lib.nvim.binds) pushDownDefault;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.notes.orgmode; cfg = config.vim.notes.orgmode;
in { in {
@ -37,10 +38,7 @@ in {
}, },
} }
require('orgmode').setup({ require('orgmode').setup(${toLuaObject cfg.setupOpts})
org_agenda_files = ${cfg.orgAgendaFiles},
org_default_notes_file = '${cfg.orgDefaultNotesFile}',
})
''; '';
}; };
} }

View file

@ -4,23 +4,31 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (lib.options) mkOption mkEnableOption; inherit (lib.modules) mkRenamedOptionModule;
inherit (lib.types) str; inherit (lib.options) mkEnableOption mkOption;
inherit (lib.nvim.types) mkGrammarOption; inherit (lib.types) str listOf;
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption;
in { 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 = { options.vim.notes.orgmode = {
enable = mkEnableOption "nvim-orgmode: Neovim plugin for Emac Orgmode. Get the best of both worlds"; enable = mkEnableOption "nvim-orgmode: Neovim plugin for Emac Orgmode. Get the best of both worlds";
orgAgendaFiles = mkOption { setupOpts = mkPluginSetupOption "Orgmode" {
type = str; org_agenda_files = mkOption {
default = "{'~/Documents/org/*', '~/my-orgs/**/*'}"; type = listOf str;
description = "List of org files to be used as agenda files."; default = ["~/Documents/org/*" "~/my-orgs/**/*"];
}; description = "List of org files to be used as agenda files.";
};
orgDefaultNotesFile = mkOption { org_default_notes_file = mkOption {
type = str; type = str;
default = "~/Documents/org/refile.org"; default = "~/Documents/org/refile.org";
description = "Default org file to be used for notes."; description = "Default org file to be used for notes.";
};
}; };
treesitter = { treesitter = {