Skip to content

Open with system gx doesn't work #139

@chianyungcode

Description

@chianyungcode

Describe the bug
In img-clip.nvim, the gx behavior resolves image paths relative to the current working directory (cwd), not the file’s directory.
For example, in this markdown file:
/Users/chianyung/Documents/vault-obsidian/notes/dailies/my-notee.md,
an image reference like my-image requires going two directories up from the note’s location.

However, since the Neovim :pwd (cwd) is /Users/chianyung/Documents/vault-obsidian, the plugin tries to resolve the path relative to that instead — causing an error when opening the image with the system, because it ends up looking in the wrong place.

Steps to reproduce
Steps to reproduce the behavior:

  1. Create a file.md in nested folder.
  2. Place you cursor below the image in the markdown file and try to open with system app with gx

Expected behavior
It will be open with system app but because it relative it should be open from the current buffer file path not cwd

Screenshots

Image

Desktop (please complete the following information):

  • OS: macOS
  • Neovim version: 0.11.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions