Skip to content

Opening files with Windows system viewer under WSL #2428

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

Closed
hendrikbursian opened this issue Sep 23, 2023 · 3 comments
Closed

Opening files with Windows system viewer under WSL #2428

hendrikbursian opened this issue Sep 23, 2023 · 3 comments
Labels
feature request PR please nvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciated

Comments

@hendrikbursian
Copy link

hendrikbursian commented Sep 23, 2023

Can this functionality be implemented utilising API?
no

Is your feature request related to a problem? Please describe.
Under WSL I cannot and don't want to open files like a PDF within the WSL instance.

Describe the solution you'd like
I would like nvim_tree to open the files with the wslview utility analog to how the vim.ui.open api does it.

Describe alternatives you've considered
For now I just do require('nvim-tree.actions.node.system-open').config.system_open.cmd = 'wslview'

Additional context
Maybe the nvim-tree.actions.node.system-open function can make use of vim.ui.open itself.

Thank you for the plugin. I use it frequently and I am very happy how it turned out.

@hendrikbursian hendrikbursian changed the title Opening files with system viewer under WSL Opening files with Windows system viewer under WSL Sep 23, 2023
@alex-courtis
Copy link
Member

vim.ui.open is rather useful. It will greatly reduce complexity and improve compatibility. Unfortunately it's not yet been released... #2430

In the interests of keeping things generic and flexible, perhaps we might allow system_open to take a function in, in the same manner as view.width. The user can then decide how top open based on, say, file name.

@alex-courtis alex-courtis added the PR please nvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciated label Sep 24, 2023
@alex-courtis
Copy link
Member

You could do something like this to replace system open:

  vim.keymap.set("n", "?", function()
    local api = require("nvim-tree.api")
    local node = api.tree.get_node_under_cursor()
    -- decide what to do with node.absolute_path
  end, opts("something something open"))

That might be preferable; changing system_open will be obsolete once ui.open is ready.

@alex-courtis
Copy link
Member

Closing this one. Proper solution will come with #2430

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request PR please nvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciated
Projects
None yet
Development

No branches or pull requests

2 participants