dotfiles/modules/programs/nvim/new_plugins/obsidian.nix

37 lines
1.8 KiB
Nix
Raw Normal View History

2024-11-22 15:59:59 +01:00
_:
{
home-manager.users.moritz.programs.nixvim = {
plugins.obsidian = {
enable = true;
settings = {
ui.enable = false;
dir = "~/Documents/Nextcloud/Notes/zettelkasten/";
note_id_func.__raw = ''
function(title)
if title ~= nil then
return title
else
suffix = ""
for _ = 1, 4 do
suffix = suffix .. string.char(math.random(65, 90))
end
return tostring(os.date("%Y-%m-%d")) .. "-" .. suffix
end
end
'';
2024-11-22 15:59:59 +01:00
mappings = {
"<localleader>n" = { action.__raw = ''function() return vim.cmd("ObsidianNew") end''; opts.desc = "New Note"; opts.buffer = true; };
"<localleader>q" = { action.__raw = ''function() return vim.cmd("ObsidianQuickSwitch") end''; opts.desc = "Quick Switch"; opts.buffer = true; };
"<localleader>b" = { action.__raw = ''function() return vim.cmd("ObsidianBacklinks") end''; opts.desc = "Backlinks"; opts.buffer = true; };
"<localleader>l" = { action.__raw = ''function() return vim.cmd("ObsidianLink") end''; opts.desc = "Link"; opts.buffer = true; };
"<localleader>e" = { action.__raw = ''function() return vim.cmd("ObsidianExtractNote") end''; opts.desc = "Extract Note"; opts.buffer = true; };
"<localleader>r" = { action.__raw = ''function() return vim.cmd("ObsidianRename") end''; opts.desc = "Rename"; opts.buffer = true; };
"<cr>" = { action.__raw = ''function() return require("obsidian").util.smart_action() end''; opts.buffer = true; opts.expr = true; };
"gf" = { action.__raw = ''function() return require("obsidian").util.gf_passthrough() end''; opts = { noremap = false; expr = true; buffer = true; }; };
};
};
};
};
}