3

I am running Windows 7 Professional. I have used the context menu for each of several file types to specify vim in the "open with" field. There are times I want to open the selected file with vim and times I want to open it with gvim. So I have both vim and gvim in the context menu when I right-click a file. The problem is that both vim and gvim have the same icon and the same program description -- "Vi Improved - A Text Editor", so they are indistinguishable in the list of programs from which to choose in the "open with" field. And whichever one I last used is the one that appears first, so I can't just select based on their relative position in the list. Is there a way that I can edit the description on each executable to make it distinct?

  • 1
    I may be wrong but I think this is off-topic: your question is about Windows not Vim. Also you might be interested in this Super User question. – statox Oct 25 '16 at 8:18
1

This requires you to edit the registry.

Run regedit.exe and navigate to the file extension under HKEY_CLASSES_ROOT. Text files for example would be

HKEY_CLASSES_ROOT > .txt

The (Default) data set will define the file type, txtfile in this example.

The next step is to navigate to the shell section of file type entry under HKEY_CLASSES_ROOT

HKEY_CLASSES_ROOT > txtfile > shell

Create a new Key (right click on shell > New > Key) and name the key the text you'd like to see (Open Text with console vim). Make a new key under this and name it command.

HKEY_CLASSES_ROOT > txtfile > shell > Open Text with console vim > command

Set the (Default) value to the command line string you'd like to execute. Use %1 to represent the file argument

cmd /K "C:\Vim\vim.exe" %1

If you want to open a file in gvim you can ditch the cmd /K stuff and just run the command directly

C:\\Vim\\gvim.exe %1

Now when you right click on any .txt file you'll see a new menu option.

Unfortunately you'll have to create this entry under every file type you want a special menu for. If you are defining new extension types you can always group the file type together by setting the (Default). So HKEY_CLASSES_ROOT > .txt contains the same (Default) value as HKEY_CLASSES_ROOT> .text.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.