Vim Tips Wiki
m (Added to Cygwin Category + minor reformatting)
m (Single config file for Vim on Windows with Cygwin installed. moved to Single config file for Vim on Windows with Cygwin: Page moved by JohnBot to improve title)

Revision as of 10:07, 18 October 2007

Previous TipNext Tip

Tip: #939 - Single config file for Vim on Windows with Cygwin

Created: June 1, 2005 4:47 Complexity: basic Author: Lee Savidge Version: 5.7 Karma: 19/13 Imported from: Tip#939

Not really an earth shattering tip but I found it handy so I thought I'd share. I got really bored of editting multiple vimrc files when I wanted to change mine. So, after installing cygwin under Windows I added an environment variable which set HOME to be c:\cygwin\home\username. Vim/GVim in windows reads that variable if it is set and notes that the config file to read is the one I have in my cygwin directory. Also, because Vim/GVim under Windows understands that the config files could be called either .vimrc or _vimrc it doesn't require any other change. Now when either Vim in cygwin or Vim/GVim in Windows loads, they both use the same config files. This assumes that your config files can work under either environment as mine do.

Comments

another option (if for some reason you don't want to change your windows HOME var) is to create a vimrc file in your windows home with the following lines...

source c:/cygwin/home/username/_vimrc 
set runtimepath+=c:/cygwin/home/username/.vim

Anonymous , June 1, 2005 6:24


I think if you have installed cygwin, you can use the following method: under cygwin:

$ cd ~ 
$ ln -s /path/to/windows/_vimrc .vimrc 

and by this way, we can use the same vimrc. Don't forget we can use " if has('win32') ..." to write config for different environment.

linsong_qizi--AT--yahoo.com.cn , June 1, 2005 18:45