mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-07 10:51:36 +00:00
treewide: begin restructuring the module tree
This commit is contained in:
parent
e1835f6c46
commit
7c730a78e5
254 changed files with 749 additions and 664 deletions
52
modules/plugins/notes/orgmode/config.nix
Normal file
52
modules/plugins/notes/orgmode/config.nix
Normal file
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
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 {
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
vim = {
|
||||
startPlugins = [
|
||||
"orgmode-nvim"
|
||||
];
|
||||
|
||||
binds.whichKey.register = pushDownDefault {
|
||||
"<leader>o" = "+Notes";
|
||||
};
|
||||
|
||||
luaConfigRC.orgmode = entryAnywhere ''
|
||||
-- Load custom treesitter grammar for org filetype
|
||||
require('orgmode').setup_ts_grammar()
|
||||
|
||||
-- Treesitter configuration
|
||||
require('nvim-treesitter.configs').setup {
|
||||
|
||||
-- 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'},
|
||||
},
|
||||
}
|
||||
|
||||
require('orgmode').setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
|
||||
vim.treesitter.grammars = [cfg.treesitter.orgPackage];
|
||||
})
|
||||
]);
|
||||
}
|
6
modules/plugins/notes/orgmode/default.nix
Normal file
6
modules/plugins/notes/orgmode/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./orgmode.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
39
modules/plugins/notes/orgmode/orgmode.nix
Normal file
39
modules/plugins/notes/orgmode/orgmode.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
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";
|
||||
|
||||
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.";
|
||||
};
|
||||
|
||||
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;};
|
||||
orgPackage = mkGrammarOption pkgs "org";
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue