commit f4b620c4e6430ea8cbc5632d6853b24da09d7dfc
parent 564173e5568ccf11bf6554680922d3716fb6862b
Author: Uthman Mohamed <83053931+uthmanmoh@users.noreply.github.com>
Date: Fri, 18 Oct 2024 05:22:15 -0400
feat(vim.ui.open): support lemonade #30845
Diffstat:
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
@@ -240,6 +240,10 @@ UI
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
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.
|hl-PmenuSel| and |hl-PmenuMatch| both inherit from |hl-Pmenu|, and
|hl-PmenuMatchSel| inherits highlights from both |hl-PmenuSel| and
diff --git a/runtime/lua/vim/ui.lua b/runtime/lua/vim/ui.lua
@@ -159,8 +159,10 @@ function M.open(path, opt)
cmd = { 'wslview', path }
elseif vim.fn.executable('explorer.exe') == 1 then
cmd = { 'explorer.exe', path }
+ elseif vim.fn.executable('lemonade') == 1 then
+ cmd = { 'lemonade', 'open', path }
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
return vim.system(cmd, job_opt), nil
diff --git a/test/functional/lua/ui_spec.lua b/test/functional/lua/ui_spec.lua
@@ -153,7 +153,7 @@ describe('vim.ui', function()
vim.fn.executable = function() return 0 end
]]
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]]
)
end)