dotfiles/.config/nvim/lua/plugins/extras/editor/docs/obsidian.lua

48 lines
1.3 KiB
Lua

return {
"epwalsh/obsidian.nvim",
event = { "BufReadPre */obsidian-vault/*.md" },
keys = {
{
"gf",
function()
if require("obsidian").util.cursor_on_markdown_link() then
return "<cmd>ObsidianFollowLink<CR>"
else
return "gf"
end
end,
noremap = false,
expr = true,
},
},
dependencies = {
"nvim-lua/plenary.nvim",
"hrsh7th/nvim-cmp",
"nvim-telescope/telescope.nvim",
},
opts = {
dir = vim.env.HOME .. "Documentos/Obsidian/obsidianVault/root", -- specify the vault location. no need to call 'vim.fn.expand' here
use_advanced_uri = true,
finder = "telescope.nvim",
mappings = {},
templates = {
subdir = "templates",
date_format = "%Y-%m-%d-%a",
time_format = "%H:%M",
},
note_frontmatter_func = function(note)
-- This is equivalent to the default frontmatter function.
local out = { id = note.id, aliases = note.aliases, tags = note.tags }
-- `note.metadata` contains any manually added fields in the frontmatter.
-- So here we just make sure those fields are kept in the frontmatter.
if note.metadata ~= nil and require("obsidian").util.table_length(note.metadata) > 0 then
for k, v in pairs(note.metadata) do
out[k] = v
end
end
return out
end,
},
}