-
-
Notifications
You must be signed in to change notification settings - Fork 87
Description
🐛 Describe the bug
When I follow links to files that have relative paths, I get an error:
Failed to resolve file 'resources/DIYWebArchiving-DombrowskiKijasKreymerWalshVisconti-V4.pdf'
And here's what my link looks like in text:
[Things disappear from the internet.](resources/DIYWebArchiving-DombrowskiKijasKreymerWalshVisconti-V4.pdf)
Even though the link works fine when opened through Obsidian. I've checked the filenames several times, I've tried prepending file: to the paths. This error happens with every locally saved file I have that is not another markdown file.
Absolute filepaths work with file: prepended (file:/home/makenzie/Dropbox/Vaults/misc/resources/DIYWebArchiving-DombrowskiKijasKreymerWalshVisconti-V4.pdf), but because I access the same vaults across both MacOS and Linux, the home directories have different paths, and using a ~ for home does not work either. I have also tried changing my link handling function to vim.ui.open(url) and that has the same issue.
Thanks in advance!
Config
-- Figure out what OS we're running
local uname = io.popen("uname")
local operatingsystem = ""
if uname then operatingsystem = uname:read() end
if uname then uname:close() end
opts = {
workspaces = {
{
name = "misc",
path = "~/Dropbox/Vaults/misc/"
},
},
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 },
},
},
new_notes_location = "current_dir",
-- Optional, customize how wiki links are formatted.
---@param opts {path: string, label: string, id: string|?}
---@return string
wiki_link_func = function(opts)
return require("obsidian.util").wiki_link_id_prefix(opts)
end,
-- Optional, customize how markdown links are formatted.
---@param opts {path: string, label: string, id: string|?}
---@return string
markdown_link_func = function(opts)
return require("obsidian.util").markdown_link(opts)
end,
preferred_link_style = 'markdown',
follow_url_func = function(url)
if operatingsystem == "Darwin" then vim.fn.jobstart({"open", url}) else vim.fn.jobstart({"xdg-open", url}) end
end,
}
require("obsidian").setup(opts)
### Environment
```nvim --version
nvim --headless -c 'lua require("obsidian").info()' -c q
NVIM v0.10.4
Build type: RelWithDebInfo
LuaJIT 2.1.1736781742
Run "nvim -V1 -v" for more info
Obsidian.nvim v3.9.0 (15b8c5fc730625a3f162817b13db144c5bba3a9f)
Status:
• buffer directory: nil
• working directory: /home/makenzie
Workspaces:
✓ active workspace: Workspace(name='misc', path='/home/makenzie/Dropbox/Vaults/misc', root='/home/makenzie/Dropbox/Vaults/misc')
✗ inactive workspace: Workspace(name='art', path='/home/makenzie/Dropbox/Vaults/art', root='/home/makenzie/Dropbox/Vaults/art')
✗ inactive workspace: Workspace(name='duelists', path='/home/makenzie/Dropbox/Vaults/duelistsofeden', root='/home/makenzie/Dropbox/Vaults/duelistsofeden')
✗ inactive workspace: Workspace(name='ttrpgs', path='/home/makenzie/Dropbox/Vaults/ttrpgs', root='/home/makenzie/Dropbox/Vaults/ttrpgs')
✗ inactive workspace: Workspace(name='ggst', path='/home/makenzie/Dropbox/Vaults/ggst', root='/home/makenzie/Dropbox/Vaults/ggst')
✗ inactive workspace: Workspace(name='granblue', path='/home/makenzie/Dropbox/Vaults/granblue', root='/home/makenzie/Dropbox/Vaults/granblue')
✗ inactive workspace: Workspace(name='programming', path='/home/makenzie/Dropbox/Vaults/programming', root='/home/makenzie/Dropbox/Vaults/programming')
✗ inactive workspace: Workspace(name='craft', path='/home/makenzie/Dropbox/Vaults/craft', root='/home/makenzie/Dropbox/Vaults/craft')
✗ inactive workspace: Workspace(name='writing', path='/home/makenzie/Dropbox/Vaults/writing', root='/home/makenzie/Dropbox/Vaults/writing')
✗ inactive workspace: Workspace(name='zettelkasten', path='/home/makenzie/Dropbox/Vaults/zettelkasten', root='/home/makenzie/Dropbox/Vaults/zettelkasten')
✗ inactive workspace: Workspace(name='university', path='/home/makenzie/Dropbox/Vaults/university', root='/home/makenzie/Dropbox/Vaults/university')
✗ inactive workspace: Workspace(name='sf6', path='/home/makenzie/Dropbox/Vaults/sf6', root='/home/makenzie/Dropbox/Vaults/sf6')
Dependencies:
✓ plenary.nvim: 857c5ac632080dba10aae49dba902ce3abf91b35
✓ nvim-cmp: 1e1900b0769324a9675ef85b38f99cca29e203b3
✓ telescope.nvim: a4ed82509cecc56df1c7138920a1aeaf246c0ac5
Integrations:
✓ picker: TelescopePicker()
✓ completion: enabled (nvim-cmp) ✗ refs, ✗ tags, ✗ new
all sources:
• luasnip
• neorg
• path
Tools:
✓ rg: ripgrep 14.1.1
Environment:
• operating system: Linux
Config:
• notes_subdir: nil%```