-
-
Notifications
You must be signed in to change notification settings - Fork 87
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
🐛 Describe the bug
It is easier to describe with an example. Consider the following note.
---
id: 1762773630-FFYY-dummy-note
aliases:
- dummy note
tags: []
---
# dummy note
## one
See [[#two]]
## two
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.When I try to Obsidian follow_link on [[#two]], instead of jumping straight to the corresponding paragraph, I get a picker that contains many notes (possibly all the notes in my vault). This is incompatible with the Obsidian app behavior, that correctly resolves links to headings in the same note.
Config
{
"obsidian-nvim/obsidian.nvim",
-- version = "*", -- recommended, use latest release instead of latest commit
dependencies = {
-- optional
"lukas-reineke/headlines.nvim",
},
config = function(_, opts)
require("obsidian").setup(opts)
local wk = require("which-key")
wk.add({
{ "<leader>o", group = "[O]bsidian" },
{ "<leader>ob", "<cmd>Obsidian backlinks<CR>", desc = "[B]acklinks" },
{ "<leader>od", "<cmd>Obsidian dailies<CR>", desc = "[D]aily notes" },
{ "<leader>on", "<cmd>Obsidian new<CR>", desc = "[N]ew note" },
{ "<leader>oo", "<cmd>Obsidian open<CR>", desc = "[O]pen note in obsidian" },
{ "<leader>op", "<cmd>Obsidian paste_img<CR>", desc = "[P]aste image" },
{ "<leader>os", "<cmd>Obsidian search<CR>", desc = "[S]earch in notes" },
{ "<leader>ot", "<cmd>Obsidian tags<CR>", desc = "Search [T]ags" },
{"<C-Space>", "<cmd>Obsidian toggle_checkbox<cr>", desc = "Toggle checkbox"},
{
mode = "v",
{ "<leader>ol", group = "[L]ink" },
{
"<leader>oll",
":Obsidian link ",
desc = "[L]ink selection to existing note",
mode = "v",
silent = false,
},
{
"<leader>oln",
":Obsidian link_new ",
desc = "Link selection to [N]ew note",
mode = "v",
silent = false,
},
},
})
end,
opts = {
legacy_commands = false,
workspaces = {
{
name = "vimwiki",
path = "~/vimwiki_markdown",
},
{
name = "personal",
path = "~/obsidian_home",
},
},
daily_notes = {
-- Optional, if you keep daily notes in a separate directory.
folder = "notes/dailies",
-- Optional, if you want to change the date format for the ID of daily notes.
date_format = "%Y-%m-%d",
-- Optional, if you want to change the date format of the default alias of daily notes.
alias_format = "%d/%m/%Y",
-- Optional, if you want to automatically insert a template from your template directory like 'daily.md'
template = nil,
},
wiki_link_func = "prepend_note_path",
-- Optional, customize how names/IDs for new notes are created.
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 parsed_title = ""
if title ~= nil then
-- If title is given, transform it into valid file name.
parsed_title = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower()
end
return require("obsidian").util.zettel_id() .. "-" .. parsed_title
end,
-- Optional, alternatively you can customize the frontmatter data.
note_frontmatter_func = function(note)
-- Add the title of the note as an alias.
if note.title then
note:add_alias(note.title)
end
return require("obsidian.builtin").frontmatter(note)
end,
-- Optional, for templates (see below).
templates = {
subdir = "templates",
date_format = "%Y-%m-%d",
time_format = "%H:%M",
-- A map for custom variables, the key should be the variable and the value a function
substitutions = {},
},
open_notes_in = "current",
-- picker = {
-- name = nil,
-- note_mappings = {
-- new = "<C-x>",
-- insert_link = "<C-l>",
-- },
-- tag_mappings = {
-- tag_note = "<C-x>",
-- insert_tag = "<C-l>",
-- },
-- },
ui = {
enable = false,
checkboxes = {
-- NOTE: the 'char' value has to be a single character, and the highlight groups are defined below.
["-"] = { char = "", hl_group = "ObsidianTilde" },
[" "] = { char = "", hl_group = "obsidiantodo" },
["~"] = { char = "", hl_group = "obsidiantilde" },
["!"] = { char = "", hl_group = "obsidianimportant" },
[">"] = { char = "", hl_group = "obsidianrightarrow" },
["x"] = { char = "", hl_group = "obsidiandone" },
["X"] = { char = "", hl_group = "obsidiandone" },
},
},
---@class obsidian.config.CheckboxOpts
---
---@field enabled? boolean
---
---Order of checkbox state chars, e.g. { " ", "x" }
---@field order? string[]
---
---Whether to create new checkbox on paragraphs
---@field create_new? boolean
checkbox = {
enabled = true,
create_new = true,
order = { " ",">","x" },
},
},
},
Environment
obsidian: ✅
- ✅ OK neovim >= 0.11
obsidian.nvim [Version] ~
- ✅ OK obsidian.nvim v3.14.4 (fcb33fb2ffccc8107b3d5ebbf93df4e0824ac8ce)
obsidian.nvim [Environment] ~
- ✅ OK operating system: Linux
obsidian.nvim [Config] ~
- ✅ OK • dir: /home/panosz/vimwiki_markdown
obsidian.nvim [Pickers] ~
- ✅ OK telescope.nvim: d143e80a1989c70d95fde7d9bd26c41e9f9928a4
- ✅ OK snacks.nvim: b0a95a027cf68d3a07c68909b73fe96818cbf7c9
obsidian.nvim [Completion] ~
- ✅ OK nvim-cmp: 106c4bcc053a5da783bf4a9d907b6f22485c2ea0
obsidian.nvim [Dependencies] ~
- ✅ OK rg: 11.0.2
- ✅ OK xclip: found
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working