aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/_defaults.lua
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2024-08-31 19:56:20 -0500
committerGitHub <noreply@github.com>2024-08-31 19:56:20 -0500
commit9762c5e3406cab8152d8dd161c0178965d841676 (patch)
tree536eb99e00ca3e4f9153c6eabc5a8f81f7aaca02 /runtime/lua/vim/_defaults.lua
parent808d73b5dfcc3024d4ddf23f902009e65acc0972 (diff)
downloadrneovim-9762c5e3406cab8152d8dd161c0178965d841676.tar.gz
rneovim-9762c5e3406cab8152d8dd161c0178965d841676.tar.bz2
rneovim-9762c5e3406cab8152d8dd161c0178965d841676.zip
feat(ui): gx: use url extmark attribute and tree-sitter directive (#30192)
Use the "url" extmark attribute as well as the "url" tree-sitter metadata key to determine if the cursor is over something Nvim considers a URL.
Diffstat (limited to 'runtime/lua/vim/_defaults.lua')
-rw-r--r--runtime/lua/vim/_defaults.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua
index 630f2219c7..38cfdbdd32 100644
--- a/runtime/lua/vim/_defaults.lua
+++ b/runtime/lua/vim/_defaults.lua
@@ -113,9 +113,11 @@ do
local gx_desc =
'Opens filepath or URI under cursor with the system handler (file explorer, web browser, …)'
vim.keymap.set({ 'n' }, 'gx', function()
- local err = do_open(require('vim.ui')._get_url())
- if err then
- vim.notify(err, vim.log.levels.ERROR)
+ for _, url in ipairs(require('vim.ui')._get_urls()) do
+ local err = do_open(url)
+ if err then
+ vim.notify(err, vim.log.levels.ERROR)
+ end
end
end, { desc = gx_desc })
vim.keymap.set({ 'x' }, 'gx', function()