On 3/22/2011 1:09 PM, Vlad Irnov wrote:

On Mar 21, 7:00 pm, howard Schwartz<[email protected]>  wrote:
I found a handy tip, for executing a string under the cursor, in mswindows by
using this mapping:

:silent !start rundll32 url.dll,FileProtocolHandler<cWORD>  <CR>

This should call a dll file which knows whether to launch a browser, an email
client, a wordprocessor etc. depending on the content of the string.

But when I try this mapping with an html string likewww.google.com, vim
addes extra characters to thewww.google.comstring. They appear too fast for
me to capture, but include things like %20  which appear to be instructions to
a terminal like xterm. My term for gvim is set to builtin_gui which seems to
work Ok. I tried setting it to win32 but got garbage.

How do I prevent extra characters from being added to my string with<cWORD>?
This should work
:nnoremap<silent>  <F12>  :silent !start rundll32
url.dll,FileProtocolHandler<cWORD><CR>

It's safer to use expand() and to escape potentially  problematic
chars in the URL string.
:nnoremap<silent>  <F12>  :exe 'silent !start rundll32
url.dll,FileProtocolHandler '.escape(expand('<cWORD>'),'%#')<CR>

Another example:
vmap <silent> <C-F5> :<C-U>let old_reg=@"<cr>gvy:silent!!start rundll32 url.dll,FileProtocolHandler <C-R><C-R>"<CR><CR>:let @"=old_reg<cr>

HTH,
Dave

--
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

Reply via email to