简体   繁体   中英

How to add gvim icon to openwith menu

I have installed gvim in windows 7. When I right click on a file, I get list of editor to be opened with. I see a icon for notepad++, 7zip and beyond compare, but not for vim. it is tough to search "Edit with Vim" in the big list. Is it possible to add icon to "Edit with Vim". I tried setting ICON in registry to gvim.exe path, but that didn't work

As far as I know, this is not possible yet. There is a whishlist bug that requests this feature, but no one has contributed code yet.

I am currently having a crack at coding this up "for real" (but no success yet). In the meantime, here's what I did on my machine as a sort of workaround: Create a new text file and call it (for example) vim.reg and paste this into the file:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\Edit with Vim]
"Icon"="\"C:\\Program Files (x86)\\Vim\\vim74\\gvim.exe\""

[HKEY_CLASSES_ROOT\*\shell\Edit with Vim\command]
@="\"C:\\Program Files (x86)\\Vim\\vim74\\gvim.exe\" \"%1\""

and then right-click on the file and select Merge. Or just manually add those keys directly in RegEdit if you're comfortable with that. You may need to restart Explorer.exe (eg. log out and back in) for it to take effect.

This will add a new "Edit with vim" entry, with the icon, to the context menu for every filetype. If you want it only for text files, for example, then change the two occurrences of "*" in the file to "txtfile". The other vim context menu entries (eg. open with existing vim session) will not be affected - they will still not have icons.

UPDATE: From the bug report that Christian mentioned, it looks like someone else has now implemented this, in version 7.4.724. Vim.org reports that the currently release is 7.4.729, so it should include that. The only trouble is that the Windows binaries available for download from the site are from 2013.

But vim.org also suggests a way to get the latest version, precompiled for Windows:

For the latest version with all patches included see Cream below.
These versions are unofficial, but the download number is high and
complaints are few.

And

For an unofficial version that does include all the latest patches and
optionally a bit more: Cream.
The "one-click installer" mentioned includes the Cream changes.
For the "real Vim" use the "without Cream" version listed further down. 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM