feat(nvim): update configuration of obsidian.nvim

This commit is contained in:
Stefan Imhoff
2023-12-30 14:51:57 +01:00
parent 7b846fd721
commit 61d0ba19f2

View File

@@ -2,10 +2,9 @@
-- https://github.com/epwalsh/obsidian.nvim
return {
"epwalsh/obsidian.nvim",
version = "*",
lazy = true,
event = {
"BufReadPre " .. vim.fn.expand("~") .. "/Library/Mobile Documents/iCloud~md~obsidian/Documents/Zettelkasten/**.md",
},
ft = "markdown",
dependencies = {
-- required
"nvim-lua/plenary.nvim",
@@ -19,6 +18,57 @@ return {
"preservim/vim-markdown",
},
opts = {
dir = "~/Library/Mobile Documents/iCloud~md~obsidian/Documents/Zettelkasten", -- no need to call 'vim.fn.expand' here
workspaces = {
{
name = "zettelkasten",
path = "~/Library/Mobile Documents/iCloud~md~obsidian/Documents/Zettelkasten",
overrides = {
notes_subdir = "pages",
},
},
{
name = "highlights",
path = "~/Library/Mobile Documents/iCloud~md~obsidian/Documents/Highlights",
},
},
completion = {
nvim_cmp = true,
min_chars = 2,
new_notes_location = "current_dir",
prepend_note_id = true,
preprend_note_path = false,
use_path_only = false,
},
mappings = {
-- Overrides the 'gf' mapping to work on markdown/wiki links within your vault.
["gf"] = {
action = function()
return require("obsidian").util.gf_passthrough()
end,
opts = { noremap = false, expr = true, buffer = true },
},
-- Toggle check-boxes.
["<leader>ch"] = {
action = function()
return require("obsidian").util.toggle_checkbox()
end,
opts = { buffer = true },
},
},
disable_frontmatter = true,
note_id_func = function(title)
local suffix = ""
if title ~= nil and title ~= "" then
suffix = title
else
suffix = tostring(os.date("%Y%m%d%H%M"))
end
return suffix
end,
templates = {
subdir = "templates",
date_format = "%Y-%m-%d",
time_format = "%H:%M",
},
},
}