2023-02-27 19:26:16 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
2023-11-07 00:50:27 +00:00
|
|
|
}: let
|
2024-02-26 03:52:21 +00:00
|
|
|
inherit (lib) mkIf mkMerge nvim pushDownDefault;
|
2023-11-07 00:50:27 +00:00
|
|
|
|
2023-02-27 19:26:16 +00:00
|
|
|
cfg = config.vim.notes.orgmode;
|
|
|
|
in {
|
2023-08-07 11:56:29 +00:00
|
|
|
config = mkIf cfg.enable (mkMerge [
|
|
|
|
{
|
|
|
|
vim.startPlugins = [
|
|
|
|
"orgmode-nvim"
|
|
|
|
];
|
2023-02-27 19:26:16 +00:00
|
|
|
|
2024-02-26 03:52:21 +00:00
|
|
|
vim.binds.whichKey.register = pushDownDefault {
|
2024-02-25 16:39:05 +00:00
|
|
|
"<leader>o" = "+Notes";
|
|
|
|
};
|
|
|
|
|
2023-08-07 11:56:29 +00:00
|
|
|
vim.luaConfigRC.orgmode = nvim.dag.entryAnywhere ''
|
|
|
|
-- Load custom treesitter grammar for org filetype
|
|
|
|
require('orgmode').setup_ts_grammar()
|
2023-02-27 19:26:16 +00:00
|
|
|
|
2023-08-07 11:56:29 +00:00
|
|
|
-- Treesitter configuration
|
|
|
|
require('nvim-treesitter.configs').setup {
|
2023-02-27 19:26:16 +00:00
|
|
|
|
2023-08-07 11:56:29 +00:00
|
|
|
-- If TS highlights are not enabled at all, or disabled via `disable` prop,
|
|
|
|
-- highlighting will fallback to default Vim syntax highlighting
|
|
|
|
highlight = {
|
|
|
|
enable = true,
|
|
|
|
-- Required for spellcheck, some LaTex highlights and
|
|
|
|
-- code block highlights that do not have ts grammar
|
|
|
|
additional_vim_regex_highlighting = {'org'},
|
|
|
|
},
|
|
|
|
}
|
2023-02-27 19:26:16 +00:00
|
|
|
|
2023-08-07 11:56:29 +00:00
|
|
|
require('orgmode').setup({
|
|
|
|
org_agenda_files = ${cfg.orgAgendaFiles},
|
|
|
|
org_default_notes_file = '${cfg.orgDefaultNotesFile}',
|
|
|
|
})
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
|
|
|
|
(mkIf cfg.treesitter.enable {
|
|
|
|
vim.treesitter.enable = true;
|
|
|
|
|
|
|
|
vim.treesitter.grammars = [cfg.treesitter.orgPackage];
|
|
|
|
})
|
|
|
|
]);
|
2023-02-27 19:26:16 +00:00
|
|
|
}
|