Right click in Windows Explorer to open gvim in explorer mode
From Vim Tips Wiki
Tip 861 Previous Tip • Next Tip
Created: January 23, 2005 Complexity: intermediate Author: corp-mule Minimum version: 6.0 Karma: 5/6 Imported from: Tip#861
There is a Windows registry setting that permits you to right click a directory in Windows Explorer to open a command prompt at that directory. I've hacked it so as to open gvim in explorer mode at that directory. You can then use the 'Explorer Mode' of gvim to navigate the directory and view or edit the files within.
REGEDIT4 [HKEY_CLASSES_ROOT\Folder\shell\GVimHere] @="gViM Here" [HKEY_CLASSES_ROOT\Folder\shell\GVimHere\command] @="C:\\Program Files\\Vim\\vim63\\gvim.exe ."
[edit] Comments
I have not tested it. but noticed the cd \"%1\""
that is "changing directory" to where you are in Explorer. You need to do the same with Vim.
And what about this key
[HKEY_CLASSES_ROOT\Folder\shell\GVimHere\command] c:\\vim\\vim63\\gvim.exe -c ":Explore" .
for win2000? tested and works good.
But only for Vim6.3 -- in my Vim7 "$VIM/plugin" directory isn't plugin "explorer.vim" present despite of that, that is mentioned in plugin/README.txt.
in Vim7, netrw.vim is used for browsing local directories. I had problems with this on WinXP, but if you
:e \vim\vim70aa\plugin\netrw.vim
/afile
and change
.... LocalBrowse(expand("<afile>"))
to
.... LocalBrowse(expand("<amatch>"))
:wq
Now when you want to browse a local dir, :e <directory> (:e ., :e c:\, etc) it will execute LocalBrowse.
gvim.exe .
will work fine.
DrChip said that he'd apply this change to netrw.vim, so you may not have to make that change in future builds of Vim7.
Categories: Review | VimTip | Windows
