nvim-orgmode / orgmode

Orgmode clone written in Lua for Neovim 0.9+.
https://nvim-orgmode.github.io/
MIT License
3.04k stars 134 forks source link

Open linked files with (system default) external application #563

Closed Maltimore closed 1 year ago

Maltimore commented 1 year ago

Does this feature exist in Emacs orgmode core?

Yes

Orgmode link

https://orgmode.org/manual/Handling-Links.html#index-C_002dc-C_002

see org-open-at-point

Feature value

It would be good to open (by default with <Leader>oo) linked files (like [[file:/home/maltimore/interesting_file.png]] with their corresponding application. I think for now we should just default to opening with the system default programs. I think on linux and macos you can just use open (might work on windows as well). So in the case above we'd just have to call open /home/maltimore/interesting_file.png.

Additional context

No response

jgollenz commented 1 year ago

Sorry, mis-clicked. Regarding open: this doesn't do what you want it to do, at least on my Ubuntu machine. Any chance you are talking about xdg-open? I think we could set that as default and have an option to configure it in case you want different program to handle the opening

Maltimore commented 1 year ago

Weirdly, open works on my KDE-neon (which is 99% ubuntu), and I seem to remember that debian at some point in the recent past decided to use open as well. Maybe I'm misremembering, but it doesn't matter anyways because xdg-open works for me as well, so we should just use that :) Yes, making it configurable is sort of the extended goal I'd say. I'm sure there is a use case where you want your default program to open a certain filetype to be A, but if you open it from within org-mode you want it to be B, but I think that's already power-user level.

jgollenz commented 1 year ago

Oh, I actually meant to make it configurable which binary takes care of opening the link, e.g.:

{ 
    ...
    -- somewhere in the config
    link_handler = 'xdg-open'
    ...
}

and then just use whatever the user has in link_handler. That use-case you described is indeed quite elaborate and I'd like to avoid making things more complicated than they are.

Do you want to take a swing at it @Maltimore?

Maltimore commented 1 year ago

Hi, sorry for never responding. I'm going to be too tight with time for the foreseeable future to work on nvim-orgmode :(. Regarding this issue, I just saw it's a duplicate of https://github.com/nvim-orgmode/orgmode/issues/506 so I'm closing here.