Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ObsidianFollowLink does not open image files #761

Open
sebiwi opened this issue Oct 26, 2024 · 2 comments
Open

ObsidianFollowLink does not open image files #761

sebiwi opened this issue Oct 26, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@sebiwi
Copy link

sebiwi commented Oct 26, 2024

🐛 Describe the bug

When I try using the ObsidianFollowLink command, of the gf mapping on an image link that's on the default assert directory (assets/imgs/x.jng), I get the following error:

# Place cursor on link, type either `:ObsidianFollowLink` or `gf`
![island.png](assets/imgs/island.png)

   Error  13:20:13 notify.error Obsidian.nvim Failed to resolve file 'assets/imgs/island.png'

If I try using the command I specified on the follow_img_func function on the terminal, it works as expected:

~/notes main ?1 ❯ qlmanage -p assets/imgs/island.png
Testing Quick Look preview with files:
        assets/imgs/island.png
2024-10-26 13:24:48.853 qlmanage[11012:8030539] +[IMKClient subclass]: chose IMKClient_Legacy
2024-10-26 13:24:48.853 qlmanage[11012:8030539] +[IMKInputSession subclass]: chose IMKInputSession_Legacy

Config

return {
  "epwalsh/obsidian.nvim",
  lazy = true,
  version = "*", -- recommended, use latest release instead of latest commit
  ft = "markdown",
  dependencies = {
    "nvim-lua/plenary.nvim",
  },
  opts = {
    mappings = {
      --- follow the link under the cursor
      ["gf"] = {
        action = function()
          return require("obsidian").util.gf_passthrough()
        end,
        opts = { noremap = false, expr = true, buffer = true },
      },
    },
    -- ... redacted for brevity
    -- Optional, by default when you use `:ObsidianFollowLink` on a link to an image
    -- file it will be ignored but you can customize this behavior here.
    ---@param img string
    follow_img_func = function(img)
      vim.fn.jobstart({ "qlmanage", "-p", img }) -- Mac OS quick look preview
      -- vim.fn.jobstart({"xdg-open", url})  -- linux
      -- vim.cmd(':silent exec "!start ' .. url .. '"') -- Windows
    end,
}

Environment

NVIM v0.10.2
Build type: Release
LuaJIT 2.1.1727870382
Run "nvim -V1 -v" for more info
Obsidian.nvim v3.9.0 (ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b)
Status:
  • buffer directory: nil
  • working directory: /Users/<redacted>/notes
Workspaces:
  ✓ active workspace: Workspace(name='notes', path='/Users/<redacted>/notes', root='/Users/<redacted>/notes')
Dependencies:
  ✓ plenary.nvim: 2d9b06177a975543726ce5c73fca176cedbffe9d
  ✓ nvim-cmp: 29fb4854573355792df9e156cb779f0d31308796
Integrations:
  ✓ picker: TelescopePicker()
  ✓ completion: enabled (nvim-cmp) ✗ refs, ✗ tags, ✗ new
    all sources:
      • copilot
      • nvim_lsp
      • path
      • buffer
      • snippets
      • lazydev
Tools:
  ✓ rg: ripgrep 14.1.1
Environment:
  • operating system: Darwin
Config:
  • notes_subdir: inbox%                                                                                                                                      
@sebiwi sebiwi added the bug Something isn't working label Oct 26, 2024
@rodhash
Copy link

rodhash commented Dec 3, 2024

+1

any news on this?

@rodhash
Copy link

rodhash commented Dec 5, 2024

https://github.com/OXY2DEV/markview.nvim solves this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants