I'm trying to set gVim to be the default text editor on Windows but it won't work. It works with notepad++, editor... but not with Vim. Any ideas how to fix it?

Screenshot: http://prntscr.com/lm069a

I also tried to choose gvim.exe with the option that opens the explorer. if I open it it works, but it doesn't save Vim as the default text editor.

  • Weird. I already had gVim set as my default editor. I changed it to notepad to test, and now I've got the same problem as you: I can't change it back!
    – Rich
    Commented Nov 23, 2018 at 13:49
  • I think the problem might be that, in Windows 10, .txt is a "protected" file type. ...although that doesn't explain why you can set the default to be notepad++.
    – Rich
    Commented Nov 23, 2018 at 14:05
  • Is this really a problem about Vim? I feel like this question would be better on superuser.com
    – statox
    Commented Nov 23, 2018 at 15:13
  • @statox Seems like kind of an edge case. The problem as described does appear to be specific to Vim, but at the same time, it looks as though the root issue is more to do with Windows (and how it interacts with the Vim executable) than Vim itself.
    – Rich
    Commented Nov 23, 2018 at 16:42

2 Answers 2


I can't comment, so here's a workaround I used: use cmd.exe in admin mode for this!

First, type in the following:

ftype VimFile="C:\Program Files (x86)\Vim\vim81\gvim.exe" --remote-silent "%1"

This ensures that any filetype (extension) associated to the VimFile we've set will, by double-click, open in gVim.

Next, choose a file extension (I chose .vim and .tex for trial) to associate with VimFile, and type:

assoc .extension=VimFile

This associates .extension to VimFile, and therefore is opened by the gvim.exe path we set before.

However, this workaround doesn't work with the NERDTree plugin, so I didn't add the option of --remote-silent "%1"; bear in mind though that this option only shows the NERDTree tree indicating the directory of the file you have chosen to double-click.

  • 1
    This is very useful. I never know that ftype could be used like this. This really solve my problem. Thank you! Commented Nov 15, 2021 at 6:48

Actually, you can set vim as your default editor by setting the path of the GVim in your PATH variable. For setting of GVim in PATH follow these steps.

You can set any application as default for you. The only thing you have to do is add the application path to the PATH variable.

  • 1
    You notice that the answer you linked directly contradicts you?
    – D. Ben Knoble
    Commented Nov 24, 2018 at 23:55
  • Here goes a direct quote from the referred link: "Adding Gvim to your PATH doesn't make Gvim the default editor for a certain file type." ==> adding the GVim path to the PATH variable only makes gvim callable.
    – llinfeng
    Commented Oct 23, 2019 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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