aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUthman Mohamed <83053931+uthmanmoh@users.noreply.github.com>2024-10-18 05:22:15 -0400
committerGitHub <noreply@github.com>2024-10-18 02:22:15 -0700
commitf4b620c4e6430ea8cbc5632d6853b24da09d7dfc (patch)
tree5878a1f1b3e2675c222099cb2bb4bbc4307e5880
parent564173e5568ccf11bf6554680922d3716fb6862b (diff)
downloadrneovim-f4b620c4e6430ea8cbc5632d6853b24da09d7dfc.tar.gz
rneovim-f4b620c4e6430ea8cbc5632d6853b24da09d7dfc.tar.bz2
rneovim-f4b620c4e6430ea8cbc5632d6853b24da09d7dfc.zip
feat(vim.ui.open): support lemonade #30845
-rw-r--r--runtime/doc/news.txt4
-rw-r--r--runtime/lua/vim/ui.lua4
-rw-r--r--test/functional/lua/ui_spec.lua2
3 files changed, 8 insertions, 2 deletions
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index db2117e69f..4027177dfe 100644
--- 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
index c0f03ceadc..f66b34ac44 100644
--- 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
index d5eede2885..5c727b3347 100644
--- 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)