Open fidgetingbits opened 3 weeks ago
note that it should also jump to definition if you use it to target an identifier
I think it should be easy to implement as long as we have a way to open the default browser that works on linux/windows/osx.
Maybe using something like https://github.com/chrishrb/gx.nvim?
I think it should be easy to implement as long as we have a way to open the default browser that works on linux/windows/osx.
Maybe using something like https://github.com/chrishrb/gx.nvim?
The gx mapping is already a default builtin that is cross-platform. In t
and nt
mode we could just have cursorless issue a gx
on the target and it's up to the user to manually install gx.nvim or not if they want something fancier. Could be listed as a recommended plugin or something.
From :help gx
:
gx Opens the current filepath or URL (decided by
|<cfile>|, 'isfname') at cursor using the system
default handler, by calling |vim.ui.open()|.
*v_gx*
{Visual}gx Opens the selected text using the system default
handler, by calling |vim.ui.open()|.
From :help vim.ui.open()
:
vim.ui.open({path}) *vim.ui.open()*
Opens `path` with the system default handler (macOS `open`, Windows
`explorer.exe`, Linux `xdg-open`, …), or returns (but does not show) an
error message on failure.
Expands "~/" and environment variables in filesystem paths.
Examples: >lua
-- Asynchronous.
vim.ui.open("https://neovim.io/")
vim.ui.open("~/path/to/file")
-- Synchronous (wait until the process exits).
local cmd, err = vim.ui.open("$VIMRUNTIME")
if cmd then
cmd:wait()
end
<
Parameters: ~
• {path} (`string`) Path or URL to open
Return (multiple): ~
(`vim.SystemObj?`) Command object, or nil if not found.
(`string?`) Error message on failure, or nil on success.
See also: ~
• |vim.system()|
For being able to jump to definition (which is outside the scope of terminal side I think?) you'd have to do some more complicated target pre-parsing to see if it is a URL, path, or a follow-able symbol I guess.
If I have a URL in the terminal and target it with
click second paint row <blah>
it doesn't open the link, like it would in vscode. It prints theopenLink Not implemented
error. This would be useful for instance if you git push and then get a PR link listed like this: