mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-19 07:29:49 +01:00
modules/notes: switch to explicit lib calls
This commit is contained in:
parent
f6db808bfc
commit
2101ac9061
13 changed files with 154 additions and 144 deletions
|
@ -1,4 +1,4 @@
|
||||||
_: {
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./obsidian
|
./obsidian
|
||||||
./orgmode
|
./orgmode
|
||||||
|
|
|
@ -3,27 +3,31 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkIf nvim pushDownDefault;
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.binds) pushDownDefault;
|
||||||
|
|
||||||
cfg = config.vim.notes.mind-nvim;
|
cfg = config.vim.notes.mind-nvim;
|
||||||
in {
|
in {
|
||||||
config = mkIf (cfg.enable) {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = [
|
vim = {
|
||||||
"mind-nvim"
|
startPlugins = [
|
||||||
];
|
"mind-nvim"
|
||||||
|
];
|
||||||
|
|
||||||
vim.maps.normal = {
|
maps.normal = {
|
||||||
"<leader>om" = {action = ":MindOpenMain<CR>";};
|
"<leader>om" = {action = ":MindOpenMain<CR>";};
|
||||||
"<leader>op" = {action = ":MindOpenProject<CR>";};
|
"<leader>op" = {action = ":MindOpenProject<CR>";};
|
||||||
"<leader>oc" = {action = ":MindClose<CR>";};
|
"<leader>oc" = {action = ":MindClose<CR>";};
|
||||||
|
};
|
||||||
|
|
||||||
|
binds.whichKey.register = pushDownDefault {
|
||||||
|
"<leader>o" = "+Notes";
|
||||||
|
};
|
||||||
|
|
||||||
|
luaConfigRC.mind-nvim = entryAnywhere ''
|
||||||
|
require'mind'.setup()
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
vim.binds.whichKey.register = pushDownDefault {
|
|
||||||
"<leader>o" = "+Notes";
|
|
||||||
};
|
|
||||||
|
|
||||||
vim.luaConfigRC.mind-nvim = nvim.dag.entryAnywhere ''
|
|
||||||
require'mind'.setup()
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
_: {
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./mind-nvim.nix
|
./mind-nvim.nix
|
||||||
./config.nix
|
./config.nix
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
{
|
{lib, ...}: let
|
||||||
config,
|
inherit (lib.options) mkEnableOption;
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib) mkEnableOption;
|
|
||||||
in {
|
in {
|
||||||
options.vim.notes.mind-nvim = {
|
options.vim.notes.mind-nvim = {
|
||||||
enable = mkEnableOption "organizer tool for Neovim.";
|
enable = mkEnableOption "note organizer tool for Neovim [mind-nvim]";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,45 +3,49 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkIf nvim pushDownDefault;
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.binds) pushDownDefault;
|
||||||
|
|
||||||
cfg = config.vim.notes.obsidian;
|
cfg = config.vim.notes.obsidian;
|
||||||
auto = config.vim.autocomplete;
|
auto = config.vim.autocomplete;
|
||||||
in {
|
in {
|
||||||
config = mkIf (cfg.enable) {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = [
|
vim = {
|
||||||
"obsidian-nvim"
|
startPlugins = [
|
||||||
"vim-markdown"
|
"obsidian-nvim"
|
||||||
"tabular"
|
"vim-markdown"
|
||||||
];
|
"tabular"
|
||||||
|
];
|
||||||
|
|
||||||
vim.binds.whichKey.register = pushDownDefault {
|
binds.whichKey.register = pushDownDefault {
|
||||||
"<leader>o" = "+Notes";
|
"<leader>o" = "+Notes";
|
||||||
};
|
};
|
||||||
|
|
||||||
vim.luaConfigRC.obsidian = nvim.dag.entryAnywhere ''
|
luaConfigRC.obsidian = entryAnywhere ''
|
||||||
require("obsidian").setup({
|
require("obsidian").setup({
|
||||||
dir = "${cfg.dir}",
|
dir = "${cfg.dir}",
|
||||||
completion = {
|
completion = {
|
||||||
nvim_cmp = ${
|
nvim_cmp = ${
|
||||||
if (auto.type == "nvim-cmp")
|
if (auto.type == "nvim-cmp")
|
||||||
then "true"
|
then "true"
|
||||||
else "false"
|
else "false"
|
||||||
}
|
|
||||||
},
|
|
||||||
daily_notes = {
|
|
||||||
folder = ${
|
|
||||||
if (cfg.daily-notes.folder == "")
|
|
||||||
then "nil,"
|
|
||||||
else "'${cfg.daily-notes.folder}',"
|
|
||||||
}
|
|
||||||
date_format = ${
|
|
||||||
if (cfg.daily-notes.date-format == "")
|
|
||||||
then "nil,"
|
|
||||||
else "'${cfg.daily-notes.date-format}',"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
},
|
||||||
'';
|
daily_notes = {
|
||||||
|
folder = ${
|
||||||
|
if (cfg.daily-notes.folder == "")
|
||||||
|
then "nil,"
|
||||||
|
else "'${cfg.daily-notes.folder}',"
|
||||||
|
}
|
||||||
|
date_format = ${
|
||||||
|
if (cfg.daily-notes.date-format == "")
|
||||||
|
then "nil,"
|
||||||
|
else "'${cfg.daily-notes.date-format}',"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
_: {
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./obsidian.nix
|
./obsidian.nix
|
||||||
./config.nix
|
./config.nix
|
||||||
|
|
|
@ -1,27 +1,24 @@
|
||||||
{
|
{lib, ...}: let
|
||||||
config,
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
lib,
|
inherit (lib.types) str bool;
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib) mkEnableOption mkOption types;
|
|
||||||
in {
|
in {
|
||||||
options.vim.notes = {
|
options.vim.notes = {
|
||||||
obsidian = {
|
obsidian = {
|
||||||
enable = mkEnableOption "complementary neovim plugins for Obsidian editor";
|
enable = mkEnableOption "complementary neovim plugins for Obsidian editor";
|
||||||
dir = mkOption {
|
dir = mkOption {
|
||||||
type = types.str;
|
type = str;
|
||||||
default = "~/my-vault";
|
default = "~/my-vault";
|
||||||
description = "Obsidian vault directory";
|
description = "Obsidian vault directory";
|
||||||
};
|
};
|
||||||
|
|
||||||
daily-notes = {
|
daily-notes = {
|
||||||
folder = mkOption {
|
folder = mkOption {
|
||||||
type = types.str;
|
type = str;
|
||||||
default = "";
|
default = "";
|
||||||
description = "Directory in which daily notes should be created";
|
description = "Directory in which daily notes should be created";
|
||||||
};
|
};
|
||||||
date-format = mkOption {
|
date-format = mkOption {
|
||||||
type = types.str;
|
type = str;
|
||||||
default = "";
|
default = "";
|
||||||
description = "Date format used for creating daily notes";
|
description = "Date format used for creating daily notes";
|
||||||
};
|
};
|
||||||
|
@ -29,8 +26,7 @@ in {
|
||||||
|
|
||||||
completion = {
|
completion = {
|
||||||
nvim_cmp = mkOption {
|
nvim_cmp = mkOption {
|
||||||
# if using nvim-cmp, otherwise set to false
|
type = bool;
|
||||||
type = types.bool;
|
|
||||||
description = "If using nvim-cmp, otherwise set to false";
|
description = "If using nvim-cmp, otherwise set to false";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,42 +3,46 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkIf mkMerge nvim pushDownDefault;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.binds) pushDownDefault;
|
||||||
|
|
||||||
cfg = config.vim.notes.orgmode;
|
cfg = config.vim.notes.orgmode;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable (mkMerge [
|
config = mkIf cfg.enable (mkMerge [
|
||||||
{
|
{
|
||||||
vim.startPlugins = [
|
vim = {
|
||||||
"orgmode-nvim"
|
startPlugins = [
|
||||||
];
|
"orgmode-nvim"
|
||||||
|
];
|
||||||
|
|
||||||
vim.binds.whichKey.register = pushDownDefault {
|
binds.whichKey.register = pushDownDefault {
|
||||||
"<leader>o" = "+Notes";
|
"<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({
|
||||||
|
org_agenda_files = ${cfg.orgAgendaFiles},
|
||||||
|
org_default_notes_file = '${cfg.orgDefaultNotesFile}',
|
||||||
|
})
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
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'},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
require('orgmode').setup({
|
|
||||||
org_agenda_files = ${cfg.orgAgendaFiles},
|
|
||||||
org_default_notes_file = '${cfg.orgDefaultNotesFile}',
|
|
||||||
})
|
|
||||||
'';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
(mkIf cfg.treesitter.enable {
|
(mkIf cfg.treesitter.enable {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
_: {
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./orgmode.nix
|
./orgmode.nix
|
||||||
./config.nix
|
./config.nix
|
||||||
|
|
|
@ -4,27 +4,28 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkEnableOption types mkOption nvim;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
|
inherit (lib.types) str;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
in {
|
in {
|
||||||
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 {
|
orgAgendaFiles = mkOption {
|
||||||
type = types.str;
|
type = str;
|
||||||
default = "{'~/Documents/org/*', '~/my-orgs/**/*'}";
|
default = "{'~/Documents/org/*', '~/my-orgs/**/*'}";
|
||||||
description = "List of org files to be used as agenda files.";
|
description = "List of org files to be used as agenda files.";
|
||||||
};
|
};
|
||||||
|
|
||||||
orgDefaultNotesFile = mkOption {
|
orgDefaultNotesFile = mkOption {
|
||||||
type = types.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 = {
|
||||||
enable = mkEnableOption "Orgmode treesitter" // {default = config.vim.languages.enableTreesitter;};
|
enable = mkEnableOption "Orgmode treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
orgPackage = mkGrammarOption pkgs "org";
|
||||||
orgPackage = nvim.types.mkGrammarOption pkgs "org";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,46 +4,49 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkMerge mkBinding mkIf;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.nvim.binds) mkBinding;
|
||||||
|
|
||||||
cfg = config.vim.notes.todo-comments;
|
cfg = config.vim.notes.todo-comments;
|
||||||
self = import ./todo-comments.nix {inherit lib;};
|
self = import ./todo-comments.nix {inherit lib;};
|
||||||
mappings = self.options.vim.notes.todo-comments.mappings;
|
inherit (self.options.vim.notes.todo-comments) mappings;
|
||||||
in {
|
in {
|
||||||
config = mkIf (cfg.enable) {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = [
|
vim = {
|
||||||
"todo-comments"
|
startPlugins = [
|
||||||
];
|
"todo-comments"
|
||||||
|
];
|
||||||
|
|
||||||
vim.maps.normal = mkMerge [
|
maps.normal = mkMerge [
|
||||||
(mkBinding cfg.mappings.quickFix ":TodoQuickFix<CR>" mappings.quickFix.description)
|
(mkBinding cfg.mappings.quickFix ":TodoQuickFix<CR>" mappings.quickFix.description)
|
||||||
(mkIf config.vim.telescope.enable (mkBinding cfg.mappings.telescope ":TodoTelescope<CR>" mappings.telescope.description))
|
(mkIf config.vim.telescope.enable (mkBinding cfg.mappings.telescope ":TodoTelescope<CR>" mappings.telescope.description))
|
||||||
(mkIf config.vim.lsp.trouble.enable (mkBinding cfg.mappings.trouble ":TodoTrouble<CR>" mappings.trouble.description))
|
(mkIf config.vim.lsp.trouble.enable (mkBinding cfg.mappings.trouble ":TodoTrouble<CR>" mappings.trouble.description))
|
||||||
];
|
];
|
||||||
|
|
||||||
vim.luaConfigRC.todo-comments = ''
|
luaConfigRC.todo-comments = ''
|
||||||
require('todo-comments').setup {
|
require('todo-comments').setup {
|
||||||
highlight = {
|
highlight = {
|
||||||
before = "", -- "fg" or "bg" or empty
|
before = "", -- "fg" or "bg" or empty
|
||||||
keyword = "bg", -- "fg", "bg", "wide" or empty
|
keyword = "bg", -- "fg", "bg", "wide" or empty
|
||||||
after = "fg", -- "fg" or "bg" or empty
|
after = "fg", -- "fg" or "bg" or empty
|
||||||
pattern = ${cfg.patterns.highlight},
|
pattern = ${cfg.patterns.highlight},
|
||||||
comments_only = true, -- uses treesitter to match keywords in comments only
|
comments_only = true, -- uses treesitter to match keywords in comments only
|
||||||
max_line_len = 400, -- ignore lines longer than this
|
max_line_len = 400, -- ignore lines longer than this
|
||||||
exclude = {}, -- list of file types to exclude highlighting
|
exclude = {}, -- list of file types to exclude highlighting
|
||||||
},
|
|
||||||
search = {
|
|
||||||
command = "${pkgs.ripgrep}/bin/rg",
|
|
||||||
args = {
|
|
||||||
"--color=never",
|
|
||||||
"--no-heading",
|
|
||||||
"--with-filename",
|
|
||||||
"--line-number",
|
|
||||||
"--column",
|
|
||||||
},
|
},
|
||||||
pattern = ${cfg.patterns.search},
|
search = {
|
||||||
},
|
command = "${pkgs.ripgrep}/bin/rg",
|
||||||
}
|
args = {
|
||||||
'';
|
"--color=never",
|
||||||
|
"--no-heading",
|
||||||
|
"--with-filename",
|
||||||
|
"--line-number",
|
||||||
|
"--column",
|
||||||
|
},
|
||||||
|
pattern = ${cfg.patterns.search},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
_: {
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./todo-comments.nix
|
./todo-comments.nix
|
||||||
./config.nix
|
./config.nix
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib) mkEnableOption mkOption types mkMappingOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
|
inherit (lib.types) str;
|
||||||
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
in {
|
in {
|
||||||
options.vim.notes.todo-comments = {
|
options.vim.notes.todo-comments = {
|
||||||
enable = mkEnableOption "todo-comments: highlight and search for todo comments like TODO, HACK, BUG in your code base";
|
enable = mkEnableOption "todo-comments: highlight and search for todo comments like TODO, HACK, BUG in your code base";
|
||||||
|
|
||||||
patterns = {
|
patterns = {
|
||||||
highlight = mkOption {
|
highlight = mkOption {
|
||||||
type = types.str;
|
type = str;
|
||||||
default = ''[[.*<(KEYWORDS)(\([^\)]*\))?:]]'';
|
default = ''[[.*<(KEYWORDS)(\([^\)]*\))?:]]'';
|
||||||
description = "vim regex pattern used for highlighting comments";
|
description = "vim regex pattern used for highlighting comments";
|
||||||
};
|
};
|
||||||
|
|
||||||
search = mkOption {
|
search = mkOption {
|
||||||
type = types.str;
|
type = str;
|
||||||
default = ''[[\b(KEYWORDS)(\([^\)]*\))?:]]'';
|
default = ''[[\b(KEYWORDS)(\([^\)]*\))?:]]'';
|
||||||
description = "ripgrep regex pattern used for searching comments";
|
description = "ripgrep regex pattern used for searching comments";
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue