neovim: add extended obsidian plugin module
This commit is contained in:
parent
928db722b4
commit
acb87b6bb1
14 changed files with 139 additions and 34 deletions
|
|
@ -5,6 +5,5 @@
|
|||
./theme.nix
|
||||
./keymaps.nix
|
||||
./plugins
|
||||
./modules
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
options,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
inherit (lib.nvim.binds) mkKeymap;
|
||||
inherit (options.vim.notes.obsidian) mappings;
|
||||
|
||||
cfg = config.vim.notes.obsidian;
|
||||
keys = cfg.mappings;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
keymaps = [
|
||||
(mkKeymap "n" keys.openNote "<cmd>ObsidianOpen<CR>" {desc = mappings.openNote.description;})
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
in {
|
||||
options.vim.notes.obsidian = {
|
||||
mappings = {
|
||||
openNote = mkMappingOption "Open obsidian note" "<leader>oo";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,10 +1,17 @@
|
|||
{
|
||||
vim = {
|
||||
notes = {
|
||||
obsidian = {
|
||||
obsidianExtended = {
|
||||
enable = true;
|
||||
setupOpts = {
|
||||
dir = "~/Documents/notes";
|
||||
daily_notes = {
|
||||
folder = "~/Documents/notes/dailies";
|
||||
};
|
||||
templates = {
|
||||
folder = "~/Documents/notes/templates";
|
||||
};
|
||||
ui.enable = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,11 +3,13 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
configuration = import ./config;
|
||||
ooks-vim = inputs.nvf.lib.neovimConfiguration {
|
||||
inherit pkgs;
|
||||
extraSpecialArgs = {inherit inputs;};
|
||||
modules = [configuration];
|
||||
modules = [
|
||||
./config
|
||||
./modules
|
||||
];
|
||||
};
|
||||
in
|
||||
ooks-vim.neovim
|
||||
|
|
|
|||
37
outputs/pkgs/ook-vim/modules/plugins/obsidian/config.nix
Normal file
37
outputs/pkgs/ook-vim/modules/plugins/obsidian/config.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
options,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.binds) mkKeymap pushDownDefault;
|
||||
inherit (options.vim.notes.obsidianExtended) mappings;
|
||||
|
||||
cfg = config.vim.notes.obsidianExtended;
|
||||
keys = cfg.mappings;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [
|
||||
"obsidian-nvim"
|
||||
"vim-markdown"
|
||||
"tabular"
|
||||
];
|
||||
|
||||
binds.whichKey.register = pushDownDefault {
|
||||
"<leader>o" = "+Notes";
|
||||
};
|
||||
|
||||
pluginRC.obsidian = entryAnywhere ''
|
||||
require("obsidian").setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
keymaps = [
|
||||
(mkKeymap "n" keys.openNote "<cmd>ObsidianOpen<CR>" {desc = mappings.openNote.description;})
|
||||
(mkKeymap "n" keys.findNote "<cmd>ObsidianQuickSwitch<CR>" {desc = mappings.findNote.description;})
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
90
outputs/pkgs/ook-vim/modules/plugins/obsidian/obsidian.nix
Normal file
90
outputs/pkgs/ook-vim/modules/plugins/obsidian/obsidian.nix
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) str nullOr bool enum;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.notes.obsidianExtended = {
|
||||
enable = mkEnableOption "Complementary neovim plugin for Obsidian editor";
|
||||
setupOpts = mkPluginSetupOption "Obsidian.nvim" {
|
||||
dir = mkOption {
|
||||
type = str;
|
||||
default = "~/my-vault";
|
||||
description = "Location of Obsidian vault directory";
|
||||
};
|
||||
daily_notes = {
|
||||
folder = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Directory in which daily notes should be created";
|
||||
};
|
||||
date_format = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Date format used for creating daily notes";
|
||||
};
|
||||
};
|
||||
completion = {
|
||||
nvim_cmp = mkOption {
|
||||
# If using nvim-cmp, otherwise set to false
|
||||
type = bool;
|
||||
description = "If using nvim-cmp, otherwise set to false";
|
||||
default = config.vim.autocomplete.nvim-cmp.enable;
|
||||
};
|
||||
};
|
||||
new_notes_location = mkOption {
|
||||
type = nullOr (enum ["current_dir" "notes_subdir"]);
|
||||
default = null;
|
||||
description = ''
|
||||
Where to put new notes. Valid options are:
|
||||
* "current_dir" - put notes in same directory as current buffer
|
||||
* "notes_subdir" - put notes in the default notes subdirectory
|
||||
|
||||
default option: "current_dir"
|
||||
'';
|
||||
};
|
||||
templates = {
|
||||
folder = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Obsidian templates directory";
|
||||
};
|
||||
date_format = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Date format used for templates";
|
||||
};
|
||||
time_format = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Time format used for templates";
|
||||
};
|
||||
};
|
||||
preferred_link_style = mkOption {
|
||||
type = nullOr (enum ["wiki" "markdown"]);
|
||||
default = null;
|
||||
description = ''
|
||||
Either "wiki" or "markdown"
|
||||
'';
|
||||
};
|
||||
ui = {
|
||||
enable = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = ''
|
||||
Set to false to disable all additional syntax features
|
||||
'';
|
||||
};
|
||||
# TODO: add rest of ui options
|
||||
};
|
||||
};
|
||||
mappings = {
|
||||
openNote = mkMappingOption "Open note in obsidian" "<leader>oo";
|
||||
findNote = mkMappingOption "Open finder in obsidian vault" "<leader>of";
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue