Vim Tips Wiki
Advertisement

This is how it was with me. I've installed Vim using windows installer, default settings (to c:\Program Files\Vim\VimXX), and started enjoying all its features. After some time, Vim became a default editor for a whole range of apps. Then new version of Vim arrived, and I've installed it too (into c:\Program Files\Vim\VimXY). Only then I've noticed that now I have to go throughout my PC to change links to vim executable. Not a pleasant task.

The tips below describe how to register Vim with various apps so that switching between different versions of Vim as a default editor for many apps could be done quickly.

Standard way

Vim Windows installer offers option to create batch file in %PATH% to invoke Vim. Just use this batch file to register Vim everywhere. When new version of Vim arrives, modify this file only (or installer can do it).

Problems:

  1. You will see black box every time you start Vim (especially annoyed me for gVim)
  2. In some circumstances, name of executable may be required anyway, batch file won't do

Overwriting Vim

Obvious way. Just install new version of Vim right on top of the old one.

Problems:

  1. Can't really switch between versions, just upgrade
  2. After a time, Vim install folder becomes a mess
  3. If Vim was initially installed to ...\VimXX, keeping new versions of Vim in the same folder feels awkward

Directory link

When installing Vim on NTFS file system (pretty much all new PC's), do the following:

  1. Go to VIM folder (ex: c:\program files\vim)
  2. Create junction (or, better, http://en.wikipedia.org/wiki/NTFS_symbolic_link) named "runtime" to the folder with the execuatble (ex: c:\program files\vim\vim73). The name runtime is important!
  3. Wherever you need to specify a path to gvim.exe, use path that goes through "runtime"

When new version of VIM arrives, do the following:

  1. Install it in the same main folder, different subfolder (ex: c:\program files\vim\vim74)
  2. Go to VIM folder (ex: c:\program files\vim)
  3. Delete existing junction "runtime" (You may need to exit all running vim instances)
  4. Create new junction "runtime" to the folder with the *new* execuatble (ex: c:\program files\vim\vim74)

That way, all vim settings throughout the system should pick up new Vim version.

References

Comments

Advertisement