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.nvim.dag) entryAnywhere;
inherit (lib.nvim.binds) pushDownDefault;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.notes.orgmode;
in {
@ -37,10 +38,7 @@ in {
},
}
require('orgmode').setup({
org_agenda_files = ${cfg.orgAgendaFiles},
org_default_notes_file = '${cfg.orgDefaultNotesFile}',
})
require('orgmode').setup(${toLuaObject cfg.setupOpts})
'';
};
}

View file

@ -4,24 +4,32 @@
pkgs,
...
}: let
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) str;
inherit (lib.nvim.types) mkGrammarOption;
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";
orgAgendaFiles = mkOption {
type = str;
default = "{'~/Documents/org/*', '~/my-orgs/**/*'}";
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.";
};
orgDefaultNotesFile = mkOption {
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;};