mirror of
https://github.com/neovim/neovim
synced 2025-07-16 09:11:51 +00:00
fix(vim.ui.open): prefer xdg-open on WSL #30302
xdg-open is usually not installed in WSL. But if the user deliberately installs it, presumably they want to prioritize it.
This commit is contained in:
@ -152,14 +152,14 @@ function M.open(path)
|
|||||||
else
|
else
|
||||||
return nil, 'vim.ui.open: rundll32 not found'
|
return nil, 'vim.ui.open: rundll32 not found'
|
||||||
end
|
end
|
||||||
elseif vim.fn.executable('wslview') == 1 then
|
|
||||||
cmd = { 'wslview', path }
|
|
||||||
elseif vim.fn.executable('explorer.exe') == 1 then
|
|
||||||
cmd = { 'explorer.exe', path }
|
|
||||||
elseif vim.fn.executable('xdg-open') == 1 then
|
elseif vim.fn.executable('xdg-open') == 1 then
|
||||||
cmd = { 'xdg-open', path }
|
cmd = { 'xdg-open', path }
|
||||||
opts.stdout = false
|
opts.stdout = false
|
||||||
opts.stderr = false
|
opts.stderr = false
|
||||||
|
elseif vim.fn.executable('wslview') == 1 then
|
||||||
|
cmd = { 'wslview', path }
|
||||||
|
elseif vim.fn.executable('explorer.exe') == 1 then
|
||||||
|
cmd = { 'explorer.exe', path }
|
||||||
else
|
else
|
||||||
return nil, 'vim.ui.open: no handler found (tried: wslview, explorer.exe, xdg-open)'
|
return nil, 'vim.ui.open: no handler found (tried: wslview, explorer.exe, xdg-open)'
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user