feat(vim.ui.open): support lemonade #30845

This commit is contained in:
Uthman Mohamed 2024-10-18 05:22:15 -04:00 committed by GitHub
parent 564173e556
commit f4b620c4e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 2 deletions

View File

@ -240,6 +240,10 @@ UI
which controls the tool used to open the given path or URL. If you want to which controls the tool used to open the given path or URL. If you want to
globally set this, you can override vim.ui.open using the same approach globally set this, you can override vim.ui.open using the same approach
described at |vim.paste()|. described at |vim.paste()|.
- `vim.ui.open()` now supports
[lemonade](https://github.com/lemonade-command/lemonade) as an option for
opening urls/files. This is handy if you are in an ssh connection and use
`lemonade`.
• The |ins-completion-menu| now supports cascading highlight styles. • The |ins-completion-menu| now supports cascading highlight styles.
|hl-PmenuSel| and |hl-PmenuMatch| both inherit from |hl-Pmenu|, and |hl-PmenuSel| and |hl-PmenuMatch| both inherit from |hl-Pmenu|, and
|hl-PmenuMatchSel| inherits highlights from both |hl-PmenuSel| and |hl-PmenuMatchSel| inherits highlights from both |hl-PmenuSel| and

View File

@ -159,8 +159,10 @@ function M.open(path, opt)
cmd = { 'wslview', path } cmd = { 'wslview', path }
elseif vim.fn.executable('explorer.exe') == 1 then elseif vim.fn.executable('explorer.exe') == 1 then
cmd = { 'explorer.exe', path } cmd = { 'explorer.exe', path }
elseif vim.fn.executable('lemonade') == 1 then
cmd = { 'lemonade', 'open', 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, lemonade)'
end end
return vim.system(cmd, job_opt), nil return vim.system(cmd, job_opt), nil

View File

@ -153,7 +153,7 @@ describe('vim.ui', function()
vim.fn.executable = function() return 0 end vim.fn.executable = function() return 0 end
]] ]]
eq( eq(
'vim.ui.open: no handler found (tried: wslview, explorer.exe, xdg-open)', 'vim.ui.open: no handler found (tried: wslview, explorer.exe, xdg-open, lemonade)',
exec_lua [[local _, err = vim.ui.open('foo') ; return err]] exec_lua [[local _, err = vim.ui.open('foo') ; return err]]
) )
end) end)