Vim Tips Wiki

Launch lynx to get info for the current word

1,624pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Tip 922 Printable Monobook Previous Next

created May 5, 2005 · complexity basic · author RichardBronosky · version 6.0

I use CTRL+L to search for the term under my cursor. The key mapping goes like this:

nmap ^L :!lynx -accept_all_cookies^R^W\#function.^R^W<CR>

Remember to use CTRL+V CTRL+L to get the ^L and CTRL+V CTRL+R to get the ^R, etc.

My workflow causes me to do most of my PHP development directly on a Unix server over an SSH connection. So, instead of switching from my terminal app to my web browser to search, I like having a single keystroke to do it.

The ^R^W inserts the word under the cursor into the command area. You can use this is many other handy key mappings. The \#func... is to tell lynx to jump to an anchor tag, since all manual pages have an anchor tag named in the form function.{functionName} (and the # is escaped as \# since Vim what to do a path substitution.) I should also note that the anchor part will only work if what you search for a) is a function and not a language construct, or a reference term b) does not contain an underscore. It will still load the page, but you will have to scroll past all of the navigation manually.


Also, use Q to quit lynx instead of just q to avoid the confirmation.

You can also use the browser plugin script#1053 to view this as a Vim buffer (and use links, etc).

nmap ,l :update<CR>:silent !start c:\progra~1\opera75\opera.exe^R^W.php<CR>

I remapped gu ('go URL') to bring up w3m:

nmap gu :!w3m ^R^A<CR>

This was my implementation (not as nice as the gu map):

" opening a text based web browser from link under the cursor
" Must be at the beginning of the URL text
" yW - yanks the WORD
" :!w3m <C-R>* - Executes the w3m text browser with contents of the unnamed register
nmap ,www yW:!w3m <C-R>*<CR>

But after testing this one works much better:

nmap gu :!w3m <C-R><C-A><CR>

Also on Fandom

Random Wiki