118 lines
3.9 KiB
Lua
118 lines
3.9 KiB
Lua
return {
|
|
"epwalsh/obsidian.nvim",
|
|
version = "*", -- recommended, use latest release instead of latest commit
|
|
lazy = false,
|
|
-- lazy = true,
|
|
-- ft = "markdown",
|
|
-- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault:
|
|
event = {
|
|
-- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'.
|
|
-- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/*.md"
|
|
-- refer to `:h file-pattern` for more examples
|
|
"BufReadPre /home/fic/second-brain/*.md",
|
|
"BufNewFile /home/fic/second-brain/*.md",
|
|
},
|
|
dependencies = {
|
|
-- Required.
|
|
"nvim-lua/plenary.nvim",
|
|
"epwalsh/pomo.nvim",
|
|
},
|
|
opts = {
|
|
workspaces = {
|
|
{
|
|
name = "second-brain",
|
|
path = "~/second-brain",
|
|
},
|
|
},
|
|
notes_subdir = "fleeting",
|
|
daily_notes = {
|
|
folder = "dailies",
|
|
date_format = "%Y-%m-%d",
|
|
alias_format = "%m %d %Y",
|
|
default_tags = { "daily_notes" },
|
|
template = nil,
|
|
},
|
|
completion = {
|
|
-- Set to false to disable completion.
|
|
nvim_cmp = true,
|
|
-- Trigger completion at 2 chars.
|
|
min_chars = 2,
|
|
},
|
|
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 },
|
|
desc = "Obsidian: Toggle Checkbox",
|
|
},
|
|
|
|
-- Smart action depending on context, either follow link or toggle checkbox.
|
|
["<cr>"] = {
|
|
action = function()
|
|
local o = require("obsidian").util
|
|
if o.cursor_on_markdown_link(nil, nil, true) then
|
|
return "<cmd>ObsidianFollowLink<CR>"
|
|
end
|
|
-- return require("obsidian").util.smart_action()
|
|
-- end,
|
|
end,
|
|
opts = { buffer = true, expr = true },
|
|
},
|
|
},
|
|
new_notes_location = "current_dir",
|
|
-- Optional, customize how note IDs are generated given an optional title.
|
|
---@param title string|?
|
|
---@return string
|
|
note_id_func = function(title)
|
|
-- Create note IDs in a Zettelkasten format with a timestamp and a suffix.
|
|
-- In this case a note with the title 'My new note' will be given an ID that looks
|
|
-- like '1657296016-my-new-note', and therefore the file name '1657296016-my-new-note.md'
|
|
local suffix = ""
|
|
if title ~= nil then
|
|
-- If title is given, transform it into valid file name.
|
|
suffix = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower()
|
|
else
|
|
-- If title is nil, just add 4 random uppercase letters to the suffix.
|
|
for _ = 1, 4 do
|
|
suffix = suffix .. string.char(math.random(65, 90))
|
|
end
|
|
end
|
|
return tostring(os.time()) .. "-" .. suffix
|
|
end,
|
|
|
|
-- Optional, customize how note file names are generated given the ID, target directory, and title.
|
|
---@param spec { id: string, dir: obsidian.Path, title: string|? }
|
|
---@return string|obsidian.Path The full path to the new note.
|
|
note_path_func = function(spec)
|
|
-- This is equivalent to the default behavior.
|
|
local path
|
|
if spec.title then
|
|
path = spec.dir / tostring(spec.title)
|
|
else
|
|
path = spec.dir / tostring(spec.id)
|
|
end
|
|
return path:with_suffix(".md")
|
|
end,
|
|
templates = {
|
|
folder = "Utility/Templates",
|
|
date_format = "%M %d %Y",
|
|
time_format = "%H:%M",
|
|
-- A map for custom variables, the key should be the variable and the value a function
|
|
substitutions = {},
|
|
},
|
|
picker = {
|
|
name = "telescope.nvim",
|
|
},
|
|
search_max_lines = 1000,
|
|
-- open_notes_in = "vsplit",
|
|
},
|
|
}
|