Mathieu Roux wrote on 07/09/2019 08:56 AM:
Hello,

Is it possible to follow a link with vim? for exemple, if my cursor is
on https://fr.wikipedia.org/wiki/Vim
i want to use my browser to go to this website.

By the same way, i can open a file with "gf" if my cursor is on the
file's name. But i don't know how to follow a link.

Best regards,
Mathieu

In Linux, I use this - mapped to Alt-Z- I put it in one my my vim startup files. This command sequence may not work if you try to do it interactively (but you can play with it to find out what does work):

map ú mzlB"lyE:!o <16><12>l &<CR>;

Explained:

ú        is alt-z- Enter this using control-V, then Alt-Z if you use same shortcut key as I do...(I avoid multi-key entry for stuff I use most often)

mz           set mark 'z' for later return

l            move one char to right if possible
B            move cursor backward one big-word (to start of URL)

"lyE         capture big-word into register 'L'

:!xdg-open   go to Ex: command line, use xdg-open to process the following arg(s)...

<16><12> In your chosen vimrc/other startup file, type control-V, control-R

l & This inserts register L contents (which you will insert using Control-R above)

The ampersand is important! In my linuxboxes (ubuntu, fedora, RHEL) the command will not work without it. I do not know why.

Hope this helps.

--

Kind Regards,

Bill Hudacek
Master Certified IT Architect

All opinions are my own, of course.


--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/cafaeb2c-d52f-7253-5367-524af66aae87%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to