This method was tested using Vim 6.2 on Win2K and Vim 6.1 on Win98. Also using Vim 7.3 on WinXP. Within the registry, you can specify the source editor to be used by Internet Explorer when View|Source is selected. Unfortunately, you can't specify a quoted filename argument here, i.e. "%1". The editor specified is supposed to handle filenames which contain spaces. This will cause problems for Vim because Vim treats each space as an argument separator. If an unquoted filename contains spaces, Vim treats the filename as multiple arguments and will open multiple files instead of one. To workaround this problem a quoted filename has to be passed to Vim. This can be done by creating the following Visual Basic Script file gVim.vbs:
Attributes | Values |
---|
rdfs:label
| - Use gvim to view page source in Internet Explorer
|
rdfs:comment
| - This method was tested using Vim 6.2 on Win2K and Vim 6.1 on Win98. Also using Vim 7.3 on WinXP. Within the registry, you can specify the source editor to be used by Internet Explorer when View|Source is selected. Unfortunately, you can't specify a quoted filename argument here, i.e. "%1". The editor specified is supposed to handle filenames which contain spaces. This will cause problems for Vim because Vim treats each space as an argument separator. If an unquoted filename contains spaces, Vim treats the filename as multiple arguments and will open multiple files instead of one. To workaround this problem a quoted filename has to be passed to Vim. This can be done by creating the following Visual Basic Script file gVim.vbs:
|
Version
| |
dbkwik:vim/property/wikiPageUsesTemplate
| |
Previous
| |
Category
| |
Author
| |
Complexity
| |
Created
| |
ID
| |
NEXT
| |
Rating
| |
abstract
| - This method was tested using Vim 6.2 on Win2K and Vim 6.1 on Win98. Also using Vim 7.3 on WinXP. Within the registry, you can specify the source editor to be used by Internet Explorer when View|Source is selected. Unfortunately, you can't specify a quoted filename argument here, i.e. "%1". The editor specified is supposed to handle filenames which contain spaces. This will cause problems for Vim because Vim treats each space as an argument separator. If an unquoted filename contains spaces, Vim treats the filename as multiple arguments and will open multiple files instead of one. To workaround this problem a quoted filename has to be passed to Vim. This can be done by creating the following Visual Basic Script file gVim.vbs: 'gVim.vbs 'function: Start gvim, combining multiple arguments to single file argument. 'changes: 20010905: Quoted 'oWShell.Run' filename argument, allowing spaces. ' 20010518: Created. 'author: Freddy Vulto option explicit dim oWShell, sArg, sFile set oWShell = CreateObject("wscript.shell") ' Loop through arguments for each sArg in wscript.arguments sFile = sFile & sArg & " " next sFile = Trim(sFile) ' Run Vim with file argument and additional arguments: ' -R: View file readonly ' -c "set syntax=html": Use HTML syntax-highlighting oWShell.Run _ """d:\program files\vim\vim60\gvim.exe """ & _ "-R """ & sFile & """ " & _ "-c ""set syntax=html""" & _ "-c ""set filetype=html""" ' Destroy script object set oWShell = NOTHING The source editor now can be specified by adding the following key to the registry: HKEY_LOCAL_MACHINE Software Microsoft Internet Explorer View Source Editor Editor Name (Default) = D:\Programs\Vim\gvim.vbs
|