diff --git a/modules/notes/mind-nvim/config.nix b/modules/notes/mind-nvim/config.nix new file mode 100644 index 0000000..2baf0ee --- /dev/null +++ b/modules/notes/mind-nvim/config.nix @@ -0,0 +1,26 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.notes.mind-nvim; +in { + config = mkIf (cfg.enable) { + vim.startPlugins = [ + "mind-nvim" + ]; + + vim.nnoremap = { + "om" = ":MindOpenMain"; + "op" = ":MindOpenProject"; + "oc" = ":MindClose"; + }; + + vim.luaConfigRC.mind-nvim = nvim.dag.entryAnywhere '' + require'mind'.setup() + ''; + }; +} diff --git a/modules/notes/mind-nvim/default.nix b/modules/notes/mind-nvim/default.nix index 4b0211f..e136b9d 100644 --- a/modules/notes/mind-nvim/default.nix +++ b/modules/notes/mind-nvim/default.nix @@ -1,30 +1,6 @@ -{ - pkgs, - config, - lib, - ... -}: -with lib; -with builtins; let - cfg = config.vim.notes.mind-nvim; -in { - options.vim.notes.mind-nvim = { - enable = mkEnableOption "The power of trees at your fingertips. "; - }; - - config = mkIf (cfg.enable) { - vim.startPlugins = [ - "mind-nvim" - ]; - - vim.nnoremap = { - "om" = ":MindOpenMain"; - "op" = ":MindOpenProject"; - "oc" = ":MindClose"; - }; - - vim.luaConfigRC.mind-nvim = nvim.dag.entryAnywhere '' - require'mind'.setup() - ''; - }; +_: { + imports = [ + ./mind-nvim.nix + ./config.nix + ]; } diff --git a/modules/notes/mind-nvim/mind-nvim.nix b/modules/notes/mind-nvim/mind-nvim.nix new file mode 100644 index 0000000..14e81c5 --- /dev/null +++ b/modules/notes/mind-nvim/mind-nvim.nix @@ -0,0 +1,14 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.notes.mind-nvim; +in { + options.vim.notes.mind-nvim = { + enable = mkEnableOption "The power of trees at your fingertips. "; + }; +} diff --git a/modules/notes/obsidian/config.nix b/modules/notes/obsidian/config.nix new file mode 100644 index 0000000..279a8b1 --- /dev/null +++ b/modules/notes/obsidian/config.nix @@ -0,0 +1,32 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.notes.obsidian; + auto = config.vim.autocomplete; +in { + config = mkIf (cfg.enable) { + vim.startPlugins = [ + "obsidian-nvim" + "vim-markdown" + "tabular" + ]; + + vim.luaConfigRC.obsidian = nvim.dag.entryAnywhere '' + require("obsidian").setup({ + dir = "${cfg.dir}", + completion = { + nvim_cmp = ${ + if (auto.type == "nvim-cmp") + then "true" + else "false" + } + } + }) + ''; + }; +} diff --git a/modules/notes/obsidian/default.nix b/modules/notes/obsidian/default.nix index f52ac02..d73bfc2 100644 --- a/modules/notes/obsidian/default.nix +++ b/modules/notes/obsidian/default.nix @@ -1,51 +1,6 @@ -{ - pkgs, - config, - lib, - ... -}: -with lib; -with builtins; let - cfg = config.vim.notes.obsidian; - auto = config.vim.autocomplete; -in { - options.vim.notes = { - obsidian = { - enable = mkEnableOption "Complementary neovim plugins for Obsidian editor"; - dir = mkOption { - type = types.str; - default = "~/my-vault"; - description = "Obsidian vault directory"; - }; - - completion = { - nvim_cmp = mkOption { - # if using nvim-cmp, otherwise set to false - type = types.bool; - description = "If using nvim-cmp, otherwise set to false"; - }; - }; - }; - }; - - config = mkIf (cfg.enable) { - vim.startPlugins = [ - "obsidian-nvim" - "vim-markdown" - "tabular" - ]; - - vim.luaConfigRC.obsidian = nvim.dag.entryAnywhere '' - require("obsidian").setup({ - dir = "${cfg.dir}", - completion = { - nvim_cmp = ${ - if (auto.type == "nvim-cmp") - then "true" - else "false" - } - } - }) - ''; - }; +_: { + imports = [ + ./obsidian.nix + ./config.nix + ]; } diff --git a/modules/notes/obsidian/obsidian.nix b/modules/notes/obsidian/obsidian.nix new file mode 100644 index 0000000..186b5d3 --- /dev/null +++ b/modules/notes/obsidian/obsidian.nix @@ -0,0 +1,30 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.notes.obsidian; + auto = config.vim.autocomplete; +in { + options.vim.notes = { + obsidian = { + enable = mkEnableOption "Complementary neovim plugins for Obsidian editor"; + dir = mkOption { + type = types.str; + default = "~/my-vault"; + description = "Obsidian vault directory"; + }; + + completion = { + nvim_cmp = mkOption { + # if using nvim-cmp, otherwise set to false + type = types.bool; + description = "If using nvim-cmp, otherwise set to false"; + }; + }; + }; + }; +} diff --git a/modules/notes/orgmode/config.nix b/modules/notes/orgmode/config.nix new file mode 100644 index 0000000..f623db3 --- /dev/null +++ b/modules/notes/orgmode/config.nix @@ -0,0 +1,40 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.notes.orgmode; +in { + config = mkIf (cfg.enable) { + vim.startPlugins = [ + "orgmode-nvim" + ]; + + vim.luaConfigRC.orgmode = nvim.dag.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'}, + }, + ensure_installed = {'org'}, -- Or run :TSUpdate org + } + + require('orgmode').setup({ + org_agenda_files = ${cfg.orgAgendaFiles}, + org_default_notes_file = '${cfg.orgDefaultNotesFile}', + }) + ''; + }; +} diff --git a/modules/notes/orgmode/default.nix b/modules/notes/orgmode/default.nix index f45b2ab..299c754 100644 --- a/modules/notes/orgmode/default.nix +++ b/modules/notes/orgmode/default.nix @@ -1,56 +1,6 @@ -{ - pkgs, - config, - lib, - ... -}: -with lib; -with builtins; let - cfg = config.vim.notes.orgmode; -in { - options.vim.notes = { - orgmode = { - enable = mkEnableOption "Neovim plugin for Emac Orgmode. Get the best of both worlds."; - orgAgendaFiles = mkOption { - type = types.str; - default = "{'~/Dropbox/org/*', '~/my-orgs/**/*'}"; - description = "List of org files to be used as agenda files."; - }; - orgDefaultNotesFile = mkOption { - type = types.str; - default = "~/Dropbox/org/refile.org"; - description = "Default org file to be used for notes."; - }; - }; - }; - - config = mkIf (cfg.enable) { - vim.startPlugins = [ - "orgmode-nvim" - ]; - - vim.luaConfigRC.orgmode = nvim.dag.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'}, - }, - ensure_installed = {'org'}, -- Or run :TSUpdate org - } - - require('orgmode').setup({ - org_agenda_files = ${cfg.orgAgendaFiles}, - org_default_notes_file = '${cfg.orgDefaultNotesFile}', - }) - ''; - }; +_: { + imports = [ + ./orgmode.nix + ./config.nix + ]; } diff --git a/modules/notes/orgmode/orgmode.nix b/modules/notes/orgmode/orgmode.nix new file mode 100644 index 0000000..c3d799a --- /dev/null +++ b/modules/notes/orgmode/orgmode.nix @@ -0,0 +1,24 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.notes.orgmode; +in { + options.vim.notes.orgmode = { + enable = mkEnableOption "Neovim plugin for Emac Orgmode. Get the best of both worlds."; + orgAgendaFiles = mkOption { + type = types.str; + default = "{'~/Dropbox/org/*', '~/my-orgs/**/*'}"; + description = "List of org files to be used as agenda files."; + }; + orgDefaultNotesFile = mkOption { + type = types.str; + default = "~/Dropbox/org/refile.org"; + description = "Default org file to be used for notes."; + }; + }; +}