Update 2025-02-28

Update 2025-02-14

Update 2025-02-16

Update 2025-02-21

Update 2025-02-23

Update 2025-02-25

Update 2025-02-27

Update 2025-02-28
This commit is contained in:
2025-02-07 19:47:38 +02:00
parent 464e342e58
commit e0f12a9ce3
36 changed files with 487 additions and 331 deletions

View File

@@ -8,6 +8,41 @@ return {
"nvim-telescope/telescope.nvim",
"nvim-treesitter/nvim-treesitter",
},
keys = {
{ "<leader>Oo", vim.cmd.ObsidianOpen, desc = "Open a note in the Obsidian app." },
{ "<leader>On", vim.cmd.ObsidianNew, desc = "Create a new note." },
{ "<leader>Of", vim.cmd.ObsidianQuickSwitch, desc = "Quickly switch to (or open) another note in vault." },
{ "<leader>Ob", vim.cmd.ObsidianBacklinks, desc = "Get a picker list of references to the current buffer." },
{ "<leader>Ot", vim.cmd.ObsidianTags, desc = "Get a picker list of all occurrences of the given tags." },
{ "<leader>Os", vim.cmd.ObsidianSearch, desc = "Search for (or create) notes in your vault." },
{
"<leader>Ol",
vim.cmd.ObsidianLinkNew,
desc = "Create a new note and link it to an inline visual selection of text.",
},
{
"<leader>OL",
vim.cmd.ObsidianLinks,
desc = "Collect all links within the current buffer into a picker window.",
},
{
"<leader>OE",
vim.cmd.ObsidianExtractNote,
desc = "Extract the visually selected text into a new note and link to it.",
},
{ "<leader>Ow", vim.cmd.ObsidianWorkspace, desc = "Switch to another workspace." },
{ "<leader>Op", vim.cmd.ObsidianPasteImg, desc = "Paste an image from the clipboard into the note." },
{
"<leader>Or",
vim.cmd.ObsidianRename,
desc = "Rename the note of the current buffer or reference under the cursor, updating all backlinks across the vault.",
},
{
"<leader>OT",
vim.cmd.ObsidianRename,
desc = "Load the table of contents of the current note into a picker list.",
},
},
opts = {
workspaces = {
{
@@ -23,6 +58,53 @@ return {
path = "~/Obsidian/work",
},
},
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.smart_action()
end,
opts = { buffer = true, expr = true },
},
-- Smart action depending on context, either follow link or toggle checkbox.
["<cr>"] = nil,
},
-- 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 wiki links are formatted. You can set this to one of:
-- * "use_alias_only", e.g. '[[Foo Bar]]'
-- * "prepend_note_id", e.g. '[[foo-bar|Foo Bar]]'
-- * "prepend_note_path", e.g. '[[foo-bar.md|Foo Bar]]'
-- * "use_path_only", e.g. '[[foo-bar.md]]'
-- Or you can set it to a function that takes a table of options and returns a string, like this:
wiki_link_func = function(opts)
return require("obsidian.util").wiki_link_id_prefix(opts)
end,
templates = {
folder = "templates",
date_format = "%Y-%m-%d",
@@ -52,5 +134,8 @@ return {
return string.format("![%s](../%s)", path.name, path)
end,
},
ui = {
enable = false,
},
},
}