Vim Tips Wiki
m (Pop up menu for checking the meaning of the word from internet moved to Internet search for the current word: Page moved by JohnBot to improve title)
m (Reverted edits by Emprego.curitiba (talk | block) to last version by JohnBeckett)
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
  +
{{TipImported
{{review}}
 
{{Tip
 
 
|id=394
 
|id=394
  +
|previous=393
|title=pop up menu for checking the meaning of the word from internet
 
  +
|next=395
|created=January 2, 2003 20:45
+
|created=2003
 
|complexity=basic
 
|complexity=basic
 
|author=xiangjiang
 
|author=xiangjiang
 
|version=6.0
 
|version=6.0
 
|rating=25/11
 
|rating=25/11
  +
|category1=
|text=
 
  +
|category2=
 
}}
  +
{{todo}}
  +
*This tip is mostly obsolete, however, it will be kept so other, similar tips can be merged to here.
  +
*A list of web browser related tips is [[VimTip127#See also|here]] (including tips which should be merged to this tip).
   
  +
==Original tip==
  +
To check the meaning of the word under the cursor, right click mouse, and choose Dic. Either IE or mozilla will be opened and dictionary service offered by www.m-w.com will be ready.
   
 
Following is the map:
To check the meaning of the word under the cursor, right click
 
   
 
To open mozilla:
mouse, and choose Dic. Either IE or mozilla will be opened
 
  +
<pre>
 
nme <silent> PopUp.&Dic :sil! !start C:/Progra~1/mozilla.org/Mozilla/mozilla -nosplash "[http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=<cword>"<CR> http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=<cword>"<CR>];
  +
</pre>
   
  +
To open Internet Explorer:
and dictionary service offered by www.m-w.com will be ready.
 
  +
<pre>
 
nme <silent> PopUp.&Dic :sil! !start iexplore -nohome "[http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=<cword>"<CR> http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=<cword>"<CR>];
  +
</pre>
   
  +
==Rough merge in from tip 833==
  +
{{todo}}
  +
*Following is the contents from tip 833 (now removed).
  +
*I have moved this here to keep it in the history of this main "look up word at cursor" tip (and 833 will redirect to here because this tip will have the most applicable content).
  +
*However, I will delete this section because the tip is a rip-off copied from someone's blog, and because when you follow the link in the blog to find the "google" Python module, you learn that it uses the old Google API that no longer functions (i.e. this code will not work).
 
----
   
  +
I started hacking vim + google APIs yesterday to do phrase lookups on Google. Google is much better (but slower than a dictionary) as a contextual speller/data verifier.
   
  +
However here is something readymade by Danny O'Brien, from http://www.oblomovka.com/entries/2003/04/16#1050554820
Following is the map:
 
   
  +
In your vimrc, add these lines:
   
  +
<pre>
  +
" ,g - create google a href for word under cursor
  +
map ,g <Esc>Bm`:r!ghref <cword><CR>"gdd``i<C-R><C-R>g<Esc>dw
  +
vmap ,g yvgvdm`:r!ghref '<C-R>=substitute(@0, "['\n]", " ", "g")<CR>'<CR>"gdd``i<C-R><C-R>g<Esc>
  +
</pre>
   
  +
Now put this program somewhere in your PATH, saved as "ghref":
To open mozilla
 
   
  +
<pre>
  +
#!/usr/bin/python
  +
# ghref - takes a string on command line, looks it up in Google, outputs
  +
# the HTML for a hyperlink for the "I'm feeling lucky" URL.
  +
import google
  +
import sys
  +
import re
   
  +
def main(argv):
  +
search = argv[0]
  +
data = google.doGoogleSearch(search)
  +
if (data.results[0].summary):
  +
title = data.results[0].summary
  +
else:
  +
title = data.results[0].title
  +
title = re.sub('</*b>','',title)
  +
print '<a href="%s" title="%s">%s</a>' % (data.results[0].URL, title, argv[0])
   
  +
if __name__ == '__main__':
nme &lt;silent&gt; PopUp.&amp;Dic :sil! !start C:/Progra~1/mozilla.org/Mozilla/mozilla -nosplash "[http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=<cword>"<CR> http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&amp;va=&lt;cword&gt;"&lt;CR&gt;];
 
  +
main(sys.argv[1:])
  +
</pre>
   
  +
==Rough merge in from tip 1157==
  +
{{todo}}
  +
*Following is the contents from tip 1157 (now removed; 1157 redirects to here).
  +
*Decide what to do with the following (will merge essential idea with other content here).
 
----
   
  +
<pre>
  +
vmap g "gy:silent! exec 'cd C:\Archivos de programa\Mozilla Firefox\ <Bar> !Start firefox "www.google.com/search?q='@g'&ie=utf-8"'<CR>
  +
</pre>
   
  +
More:
To open internet explorer:
 
  +
<pre>
  +
vmap gw "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "images.google.com/images?q='@g'&ie=utf-8"'<CR>
  +
vmap gn "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "news.google.com/news?q='@g'&ie=utf-8"'<CR>
  +
vmap gg "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "groups.google.com/groups?q='@g'&ie=utf-8"'<CR>
  +
vmap gb "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "books.google.com/books?q='@g'&ie=utf-8"'<CR>
  +
</pre>
   
  +
----
  +
search: vim scripts & tips
  +
<pre>
  +
vmap vt "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "www.vim.org/tips/tip_search_results.php?keywords='@g'&order_by=rating&direction=descending&search=search"'<CR><Esc>
  +
vmap vs "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "www.vim.org/scripts/script_search_results.php?keywords='@g'&script_type=&order_by=creation_date&direction=descending&search=search"'<CR><Esc>
  +
</pre>
   
  +
----
  +
Menu:
  +
<pre>
  +
vmenu 9998.10 &Websearch.&Google.&Web "gy:silent! exec 'cd C:\Archivos de programa\Mozilla Firefox\ <Bar> !Start firefox "www.google.com/search?q='@g'"'<CR><Esc>
  +
vmenu 9998.11 &Websearch.&Google.Web-utf-&8 "gy:silent! exec 'cd C:\Archivos de programa\Mozilla Firefox\ <Bar> !Start firefox "www.google.com/search?q='@g'&ie=utf-8"'<CR><Esc>
  +
vmenu 9998.12 &Websearch.&Google.&Images "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "images.google.com/images?q='@g'"'<CR><Esc>
  +
vmenu 9998.13 &Websearch.&Google.I&mages-utf-8 "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "images.google.com/images?q='@g'&ie=utf-8"'<CR><Esc>
  +
vmenu 9998.14 &Websearch.&Google.&News "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "news.google.com/news?q='@g'"'<CR><Esc>
  +
vmenu 9998.15 &Websearch.&Google.N&ews-utf-8 "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "news.google.com/news?q='@g'&ie=utf-8"'<CR><Esc>
  +
vmenu 9998.16 &Websearch.&Google.&Books "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "books.google.com/books?q='@g'"'<CR><Esc>
  +
vmenu 9998.17 &Websearch.&Google.B&ooks-utf-8 "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "books.google.com/books?q='@g'&ie=utf-8"'<CR><Esc>
  +
vmenu 9998.18 &Websearch.&Google.&Groups "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "groups.google.com/groups?q='@g'"'<CR><Esc>
  +
vmenu 9998.19 &Websearch.&Google.G&roups-utf-8 "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "groups.google.com/groups?q='@g'&ie=utf-8"'<CR><Esc>
  +
vmenu 9998.30 &Websearch.&Dictionary\.com.&Dictionary "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "dictionary.reference.com/search?q='@g'&db=*"'<CR><Esc>
  +
vmenu 9998.31 &Websearch.&Dictionary\.com.&Thesaurus "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "thesaurus.reference.com/search?q='@g'&db=roget"'<CR><Esc>
  +
vmenu 9998.32 &Websearch.&Dictionary\.com.&Encyclopedia "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "www.reference.com/search?q='@g'&db=encyclopedia"'<CR><Esc>
  +
vmenu 9998.90 &Websearch.&DEX "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "dexonline.ro/search.php?cuv='@g'"'<CR><Esc>
  +
vmenu 9998.91 &Websearch.Merriam-&Webster.&Dictionary "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "www.merriam-webster.com/cgi-bin/dictionary?book=Dictionary&va='@g'"'<CR><Esc>
  +
vmenu 9998.92 &Websearch.Merriam-&Webster.&Thesaurus "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "www.merriam-webster.com/cgi-bin/thesaurus?book=Thesaurus&va='@g'"'<CR><Esc>
  +
vmenu 9998.93 &Websearch.&Vim.&Tips "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "www.vim.org/tips/tip_search_results.php?keywords='@g'&order_by=rating&direction=descending&search=search"'<CR><Esc>
  +
vmenu 9998.94 &Websearch.&Vim.&Scripts "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "www.vim.org/scripts/script_search_results.php?keywords='@g'&script_type=&order_by=creation_date&direction=descending&search=search"'<CR><Esc>
  +
</pre>
   
 
==Comments==
nme &lt;silent&gt; PopUp.&amp;Dic :sil! !start iexplore -nohome "[http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=<cword>"<CR> http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&amp;va=&lt;cword&gt;"&lt;CR&gt;];
 
 
Although ':sil! !start notepad' works on my system (XP Pro), ':sil! !start iexplore' does not. I used this instead:
  +
<pre>
 
nme <silent> PopUp.&Dic :sil! !start "C:\Program Files\Internet Explorer\iexplore.exe" -nohome "http://www.m-w.com/cgi-bin/dictionary? book=Dictionary&va=<cword>"<CR>;
  +
</pre>
   
 
 
This is tested for gvim.exe on windows 2000 professional.
 
 
 
 
 
}}
 
 
== Comments ==
 
Although ':sil! !start notepad' works on my system (XP Pro), ':sil! !start iexplore' does not. I used this instead:
 
nme &lt;silent&gt; PopUp.&amp;Dic :sil! !start "C:\Program Files\Internet Explorer\iexplore.exe" -nohome "http://www.m-w.com/cgi-bin/dictionary? book=Dictionary&amp;va=&lt;cword&gt;"&lt;CR&gt;;
 
Fantastic idea. Thanks.
 
-Mark
 
 
mark.thomas--AT--bigswamp.org
 
, January 3, 2003 1:55
 
 
----
 
----
 
Want to search Google for cWORD under the cursor?
 
  +
<pre>
Want to search Google for cWORD under the cursor?
 
 
nm gF vviWgF
 
 
vn<silent> gF y:sil! !start C:/progra~1/intern~1/iexplore.exe -nohome [http://www.google.com/search?hl=en&q=<C-R>0<CR> http://www.google.com/search?hl=en&q=<C-R>0<CR>];
(Both normal and visual maps were tested on windows 2000 professional)
 
  +
</pre>
 
nm gF vviWgF
 
 
vn&lt;silent&gt; gF y:sil! !start C:/progra~1/intern~1/iexplore.exe -nohome [http://www.google.com/search?hl=en&q=<C-R>0<CR> http://www.google.com/search?hl=en&amp;q=&lt;C-R&gt;0&lt;CR&gt;];
 
 
 
 
   
maxiangjiang--AT--hotmail.com
 
, January 7, 2003 16:47
 
 
----
 
----
 
Another one, just open stand URL under the cursor:
 
Another one, just open stand URL under the cursor:
 
   
 
For example: http://vim.sourceforge.net
 
For example: http://vim.sourceforge.net
 
ftp://ftp.vim.org/pub/vim/patches/README
 
ftp://ftp.vim.org/pub/vim/patches/README
  +
<pre>
 
nm gF viWgF
 
vn<silent> gF y:sil! !start C:/progra~1/intern~1/iexplore.exe <C-R>=escape(@0,"#%")<CR><CR>
  +
</pre>
   
(Both normal and visual maps were tested on windows 2000 professional)
 
 
nm gF viWgF
 
 
vn&lt;silent&gt; gF y:sil! !start C:/progra~1/intern~1/iexplore.exe &lt;C-R&gt;=escape(--AT--0,"&#35;%")&lt;CR&gt;&lt;CR&gt;
 
 
 
 
 
maxiangjiang--AT--hotmail.com
 
, January 7, 2003 16:53
 
 
----
 
----
 
Another cute one:
 
Another cute one:
 
   
Open Windows Explorer on the current working directory from within gvim:
+
Open Windows Explorer on the current working directory from within gvim:
right click the mouse, and choose Explorer or hit "e"
+
right click the mouse, and choose Explorer or hit "e".
  +
<pre>
 
nme <silent> PopUp.&Explorer :sil! !start C:/progra~1/intern~1/iexplore.exe -nohome -e "<C-R>=getcwd()<CR>"<CR>
  +
</pre>
   
nme &lt;silent&gt; PopUp.&amp;Explorer :sil! !start C:/progra~1/intern~1/iexplore.exe -nohome -e "&lt;C-R&gt;=getcwd()&lt;CR&gt;"&lt;CR&gt;
 
 
 
 
maxiangjiang--AT--hotmail.com
 
, January 7, 2003 17:24
 
 
----
 
----
Using internet explorer with leo (german&lt;-&gt;english):
+
Using Internet Explorer with leo (german<->english):
  +
<pre>
 
nme <silent> PopUp.&Dic :sil! !start "c:\programme\Internet explorer\iexplore.exe" -nohome "[http://dict.leo.org/?search=<cword>"<CR> http://dict.leo.org/?search=<cword>"<CR>];
  +
</pre>
   
nme &lt;silent&gt; PopUp.&amp;Dic :sil! !start "c:\programme\Internet explorer\iexplore.exe" -nohome "[http://dict.leo.org/?search=<cword>"<CR> http://dict.leo.org/?search=&lt;cword&gt;"&lt;CR&gt;];
 
 
tnx for the tip !
 
Thomas
 
 
'''Anonymous'''
 
, January 7, 2003 23:29
 
 
----
 
----
 
Since we Linux users use our right click to highlight large blocks of text, this might be helpful to some.
Is there a secret to making this work on Linux/UNIX?
 
   
 
I you are using gvim, you could just add a menu in your .vimrc like so:
'''Anonymous'''
 
  +
<pre>
, January 9, 2003 8:56
 
 
amenu &Lookup.&PHP :sil! !devphoenix.sh "[http://www.php.net/<cword>"<CR> http://www.php.net/<cword>"<CR>];;
----
 
 
amenu &Lookup.&Google :sil! !devphoenix.sh "[http://www.google.com/search?q=<cword>"<CR> http://www.google.com/search?q=<cword>"<CR>];;
Since we Linux users use our right click to highlight large blocks of text, this might be helpful to some.
 
  +
</pre>
   
 
where devphoenix.sh is a shell script like so:
I you are using gvim, you could just add a menu in your .vimrc like so:
 
  +
<pre>
 
#!/bin/bash
 
BROWSER=~/apps/phoenix/phoenix
 
BROWSER_BIN=phoenix-bin
   
 
if [ -z `ps --noheaders -o pid -C $BROWSER_BIN| head -1` ]
amenu &amp;Lookup.&amp;PHP :sil! !devphoenix.sh "[http://www.php.net/<cword>"<CR> http://www.php.net/&lt;cword&gt;"&lt;CR&gt;];;
 
 
then $BROWSER & sleep 5
amenu &amp;Lookup.&amp;Google :sil! !devphoenix.sh "[http://www.google.com/search?q=<cword>"<CR> http://www.google.com/search?q=&lt;cword&gt;"&lt;CR&gt;];;
 
 
fi
  +
</pre>
   
  +
<pre>
where devphoenix.sh is a shell script like so:
 
 
$BROWSER -remote "openURL($1,new-tab)"
--------------
 
  +
</pre>
&#35;!/bin/bash
 
BROWSER=~/apps/phoenix/phoenix
 
BROWSER_BIN=phoenix-bin
 
   
 
This way, if you have a browser open, you get it in a new tab, otherwise you just get the url. I use this little script all the time. Of course, you can leave out the script and just call it directly, etc.
if [ -z `ps --noheaders -o pid -C $BROWSER_BIN| head -1` ]
 
then $BROWSER &amp; sleep 5
 
fi
 
   
 
If you use console vim, I'm sure that you could bind it to a key command with map instead of "amenu [menuitem]". But I've never tried.
$BROWSER -remote "openURL($1,new-tab)"
 
----------------
 
This way, if you have a browser open, you get it in a new tab, otherwise you just get the url. I use this little script all the time. ;-) Of course, you can leave out the script and just call it directly, etc.
 
   
  +
===Related scripts===
if you use console vim, I'm sure that you could bind it to a key command with map instead of "amenu [menuitem]". But I've never tried.
 
  +
*{{script|id=2528}} thesaurus suggestion script
 
dholmes--AT--jccc.net
 
, January 23, 2003 7:48
 
----
 
<!-- parsed by vimtips.py in 0.676504 seconds-->
 

Latest revision as of 14:39, 8 November 2011

Tip 394 Printable Monobook Previous Next

created 2003 · complexity basic · author xiangjiang · version 6.0


 TO DO 

  • This tip is mostly obsolete, however, it will be kept so other, similar tips can be merged to here.
  • A list of web browser related tips is here (including tips which should be merged to this tip).

Original tip[]

To check the meaning of the word under the cursor, right click mouse, and choose Dic. Either IE or mozilla will be opened and dictionary service offered by www.m-w.com will be ready.

Following is the map:

To open mozilla:

nme <silent> PopUp.&Dic :sil! !start C:/Progra~1/mozilla.org/Mozilla/mozilla -nosplash "[http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=<cword>"<CR> http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=<cword>"<CR>];

To open Internet Explorer:

nme <silent> PopUp.&Dic :sil! !start iexplore -nohome "[http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=<cword>"<CR> http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=<cword>"<CR>];

Rough merge in from tip 833[]

 TO DO 

  • Following is the contents from tip 833 (now removed).
  • I have moved this here to keep it in the history of this main "look up word at cursor" tip (and 833 will redirect to here because this tip will have the most applicable content).
  • However, I will delete this section because the tip is a rip-off copied from someone's blog, and because when you follow the link in the blog to find the "google" Python module, you learn that it uses the old Google API that no longer functions (i.e. this code will not work).

I started hacking vim + google APIs yesterday to do phrase lookups on Google. Google is much better (but slower than a dictionary) as a contextual speller/data verifier.

However here is something readymade by Danny O'Brien, from http://www.oblomovka.com/entries/2003/04/16#1050554820

In your vimrc, add these lines:

" ,g - create google a href for word under cursor
map ,g <Esc>Bm`:r!ghref <cword><CR>"gdd``i<C-R><C-R>g<Esc>dw
vmap ,g yvgvdm`:r!ghref '<C-R>=substitute(@0, "['\n]", " ", "g")<CR>'<CR>"gdd``i<C-R><C-R>g<Esc>

Now put this program somewhere in your PATH, saved as "ghref":

#!/usr/bin/python
# ghref - takes a string on command line, looks it up in Google, outputs
# the HTML for a hyperlink for the "I'm feeling lucky" URL.
import google
import sys
import re

def main(argv):
  search = argv[0]
  data = google.doGoogleSearch(search)
  if (data.results[0].summary):
    title = data.results[0].summary
  else:
    title = data.results[0].title
    title = re.sub('</*b>','',title)
    print '<a href="%s" title="%s">%s</a>' % (data.results[0].URL, title, argv[0])

if __name__ == '__main__':
  main(sys.argv[1:])

Rough merge in from tip 1157[]

 TO DO 

  • Following is the contents from tip 1157 (now removed; 1157 redirects to here).
  • Decide what to do with the following (will merge essential idea with other content here).

vmap g "gy:silent! exec 'cd C:\Archivos de programa\Mozilla Firefox\ <Bar> !Start firefox "www.google.com/search?q='@g'&ie=utf-8"'<CR>

More:

vmap gw "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "images.google.com/images?q='@g'&ie=utf-8"'<CR>
vmap gn "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "news.google.com/news?q='@g'&ie=utf-8"'<CR>
vmap gg "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "groups.google.com/groups?q='@g'&ie=utf-8"'<CR>
vmap gb "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "books.google.com/books?q='@g'&ie=utf-8"'<CR>

search: vim scripts & tips

vmap vt "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "www.vim.org/tips/tip_search_results.php?keywords='@g'&order_by=rating&direction=descending&search=search"'<CR><Esc>
vmap vs "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "www.vim.org/scripts/script_search_results.php?keywords='@g'&script_type=&order_by=creation_date&direction=descending&search=search"'<CR><Esc>

Menu:

vmenu 9998.10 &Websearch.&Google.&Web "gy:silent! exec 'cd C:\Archivos de programa\Mozilla Firefox\ <Bar> !Start firefox "www.google.com/search?q='@g'"'<CR><Esc>
vmenu 9998.11 &Websearch.&Google.Web-utf-&8 "gy:silent! exec 'cd C:\Archivos de programa\Mozilla Firefox\ <Bar> !Start firefox "www.google.com/search?q='@g'&ie=utf-8"'<CR><Esc>
vmenu 9998.12 &Websearch.&Google.&Images "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "images.google.com/images?q='@g'"'<CR><Esc>
vmenu 9998.13 &Websearch.&Google.I&mages-utf-8 "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "images.google.com/images?q='@g'&ie=utf-8"'<CR><Esc>
vmenu 9998.14 &Websearch.&Google.&News "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "news.google.com/news?q='@g'"'<CR><Esc>
vmenu 9998.15 &Websearch.&Google.N&ews-utf-8 "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "news.google.com/news?q='@g'&ie=utf-8"'<CR><Esc>
vmenu 9998.16 &Websearch.&Google.&Books "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "books.google.com/books?q='@g'"'<CR><Esc>
vmenu 9998.17 &Websearch.&Google.B&ooks-utf-8 "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "books.google.com/books?q='@g'&ie=utf-8"'<CR><Esc>
vmenu 9998.18 &Websearch.&Google.&Groups "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "groups.google.com/groups?q='@g'"'<CR><Esc>
vmenu 9998.19 &Websearch.&Google.G&roups-utf-8 "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "groups.google.com/groups?q='@g'&ie=utf-8"'<CR><Esc>
vmenu 9998.30 &Websearch.&Dictionary\.com.&Dictionary "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "dictionary.reference.com/search?q='@g'&db=*"'<CR><Esc>
vmenu 9998.31 &Websearch.&Dictionary\.com.&Thesaurus "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "thesaurus.reference.com/search?q='@g'&db=roget"'<CR><Esc>
vmenu 9998.32 &Websearch.&Dictionary\.com.&Encyclopedia "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "www.reference.com/search?q='@g'&db=encyclopedia"'<CR><Esc>
vmenu 9998.90 &Websearch.&DEX "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "dexonline.ro/search.php?cuv='@g'"'<CR><Esc>
vmenu 9998.91 &Websearch.Merriam-&Webster.&Dictionary "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "www.merriam-webster.com/cgi-bin/dictionary?book=Dictionary&va='@g'"'<CR><Esc>
vmenu 9998.92 &Websearch.Merriam-&Webster.&Thesaurus "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "www.merriam-webster.com/cgi-bin/thesaurus?book=Thesaurus&va='@g'"'<CR><Esc>
vmenu 9998.93 &Websearch.&Vim.&Tips "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "www.vim.org/tips/tip_search_results.php?keywords='@g'&order_by=rating&direction=descending&search=search"'<CR><Esc>
vmenu 9998.94 &Websearch.&Vim.&Scripts "gy:silent! exec '!Start C:\Archivos de programa\Mozilla Firefox\firefox "www.vim.org/scripts/script_search_results.php?keywords='@g'&script_type=&order_by=creation_date&direction=descending&search=search"'<CR><Esc>

Comments[]

Although ':sil! !start notepad' works on my system (XP Pro), ':sil! !start iexplore' does not. I used this instead:

nme <silent> PopUp.&Dic :sil! !start "C:\Program Files\Internet Explorer\iexplore.exe" -nohome "http://www.m-w.com/cgi-bin/dictionary? book=Dictionary&va=<cword>"<CR>;

Want to search Google for cWORD under the cursor?

nm gF vviWgF
vn<silent> gF y:sil! !start C:/progra~1/intern~1/iexplore.exe -nohome [http://www.google.com/search?hl=en&q=<C-R>0<CR> http://www.google.com/search?hl=en&q=<C-R>0<CR>];

Another one, just open stand URL under the cursor:

For example: http://vim.sourceforge.net ftp://ftp.vim.org/pub/vim/patches/README

nm gF viWgF
vn<silent> gF y:sil! !start C:/progra~1/intern~1/iexplore.exe <C-R>=escape(@0,"#%")<CR><CR>

Another cute one:

Open Windows Explorer on the current working directory from within gvim: right click the mouse, and choose Explorer or hit "e".

nme <silent> PopUp.&Explorer :sil! !start C:/progra~1/intern~1/iexplore.exe -nohome -e "<C-R>=getcwd()<CR>"<CR>

Using Internet Explorer with leo (german<->english):

nme <silent> PopUp.&Dic :sil! !start "c:\programme\Internet explorer\iexplore.exe" -nohome "[http://dict.leo.org/?search=<cword>"<CR> http://dict.leo.org/?search=<cword>"<CR>];

Since we Linux users use our right click to highlight large blocks of text, this might be helpful to some.

I you are using gvim, you could just add a menu in your .vimrc like so:

amenu &Lookup.&PHP :sil! !devphoenix.sh "[http://www.php.net/<cword>"<CR> http://www.php.net/<cword>"<CR>];;
amenu &Lookup.&Google :sil! !devphoenix.sh "[http://www.google.com/search?q=<cword>"<CR> http://www.google.com/search?q=<cword>"<CR>];;

where devphoenix.sh is a shell script like so:

#!/bin/bash
BROWSER=~/apps/phoenix/phoenix
BROWSER_BIN=phoenix-bin

if [ -z `ps --noheaders -o pid -C $BROWSER_BIN| head -1` ]
 then $BROWSER & sleep 5
fi
$BROWSER -remote "openURL($1,new-tab)"

This way, if you have a browser open, you get it in a new tab, otherwise you just get the url. I use this little script all the time. Of course, you can leave out the script and just call it directly, etc.

If you use console vim, I'm sure that you could bind it to a key command with map instead of "amenu [menuitem]". But I've never tried.

Related scripts[]