Closed Tetra-20 closed 8 months ago
Huh... that's odd. Can you run this from a note in your vault and tell me what's printed:
lua print(require("obsidian").get_client():vault_relative_path("~/Documents/T-20/Random/300 Other/A Note.md"))
It prints: m/300 Other/A Note.md
Is your vault behind a symlink?
No, this issue still happens even when I change the workspace directory to its parent folder (~/Documents/T-20
)
Do you use the Obsidian app? Do you have a .obsidian folder?
Yes, I do have the app and have the .obsidian folder, but it's with default settings.
Hmm, okay I'm still not able to reproduce so this might be an OS-specific bug (likely with plenary.nvim). Can you step through the Client:vault_relative_path
function to debug?
I would just throw print statements after each line. That way we can see where it goes wrong.
The issue is the j
variable in line 180. The solution for me is to increase the variable by 2 in order to account for the last character of the workspace name (m) and the directory. (/) This would mean "m/" is removed from the link. Thanks for the help!
Thanks for figuring that out @Tetra-20! I'll add that fix in #322
🐛 Describe the bug
Hi, so when I use nvim-cmp to complete either an md link or wikilink with
prepend_note_path
enabled, it leaves an unwanted "m/". I found out that this is the from the name of the workspace folder which I set it to is named "Random".(Minimal) obsidian and nvim-cmp config:
Versions
nvim --version
lua require("obsidian").info()