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)