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)
(Change to TipImported template + severe manual clean)
Line 1: Line 1:
 
{{review}}
 
{{review}}
  +
{{TipImported
{{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=January 2, 2003
 
|complexity=basic
 
|complexity=basic
 
|author=xiangjiang
 
|author=xiangjiang
 
|version=6.0
 
|version=6.0
 
|rating=25/11
 
|rating=25/11
 
}}
|text=
 
  +
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:
To check the meaning of the word under the cursor, right click
 
   
 
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;];
mouse, and choose Dic. Either IE or mozilla will be opened
 
   
  +
To open Internet Explorer:
and dictionary service offered by www.m-w.com will be ready.
 
   
 
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;];
   
 
==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;;
Following is the map:
 
   
 
 
To open mozilla
 
 
 
 
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;];
 
 
 
 
To open internet explorer:
 
 
 
 
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;];
 
 
 
 
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?
 
Want to search Google for cWORD under the cursor?
 
   
 
nm gF vviWgF
(Both normal and visual maps were tested on windows 2000 professional)
 
 
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;];
   
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
   
 
nm gF viWgF
(Both normal and visual maps were tested on windows 2000 professional)
 
 
vn&lt;silent&gt; gF y:sil! !start C:/progra~1/intern~1/iexplore.exe &lt;C-R&gt;=escape(@0,"#%")&lt;CR&gt;&lt;CR&gt;
   
 
----
nm gF viWgF
 
 
Another cute one:
   
 
Open Windows Explorer on the current working directory from within gvim:
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;
 
 
right click the mouse, and choose Explorer or hit "e".
   
 
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 16:53
 
 
----
 
----
 
Using Internet Explorer with leo (german&lt;-&gt;english):
 
Another cute one:
 
   
 
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;];
Open Windows Explorer on the current working directory from within gvim:
 
right click the mouse, and choose Explorer or hit "e"
 
   
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
 
 
----
 
----
 
Since we Linux users use our right click to highlight large blocks of text, this might be helpful to some.
Using internet explorer with leo (german&lt;-&gt;english):
 
   
 
I you are using gvim, you could just add a menu in your .vimrc like so:
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;];
 
   
 
amenu &amp;Lookup.&amp;PHP :sil! !devphoenix.sh "[http://www.php.net/<cword>"<CR> http://www.php.net/&lt;cword&gt;"&lt;CR&gt;];;
tnx for the tip !
 
 
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;];;
Thomas
 
 
'''Anonymous'''
 
, January 7, 2003 23:29
 
----
 
Is there a secret to making this work on Linux/UNIX?
 
 
'''Anonymous'''
 
, January 9, 2003 8:56
 
----
 
Since we Linux users use our right click to highlight large blocks of text, this might be helpful to some.
 
   
 
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>
amenu &amp;Lookup.&amp;PHP :sil! !devphoenix.sh "[http://www.php.net/<cword>"<CR> http://www.php.net/&lt;cword&gt;"&lt;CR&gt;];;
 
 
#!/bin/bash
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;];;
 
 
BROWSER=~/apps/phoenix/phoenix
 
BROWSER_BIN=phoenix-bin
   
 
if [ -z `ps --noheaders -o pid -C $BROWSER_BIN| head -1` ]
where devphoenix.sh is a shell script like so:
 
 
then $BROWSER &amp; sleep 5
--------------
 
 
fi
&#35;!/bin/bash
 
  +
</pre>
BROWSER=~/apps/phoenix/phoenix
 
BROWSER_BIN=phoenix-bin
 
   
 
$BROWSER -remote "openURL($1,new-tab)"
if [ -z `ps --noheaders -o pid -C $BROWSER_BIN| head -1` ]
 
then $BROWSER &amp; sleep 5
 
fi
 
   
 
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.
$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.
+
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.
   
dholmes--AT--jccc.net
 
, January 23, 2003 7:48
 
 
----
 
----
<!-- parsed by vimtips.py in 0.676504 seconds-->
 

Revision as of 12:33, 2 November 2007

Tip 394 Printable Monobook Previous Next

created January 2, 2003 · complexity basic · author xiangjiang · version 6.0


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 "<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 "<cword> "<CR> http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=<cword>"<CR>;

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 <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 "<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 "<cword> "<CR> http://www.php.net/<cword>"<CR>;;
amenu &Lookup.&Google :sil! !devphoenix.sh "<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.