Backing up and commenting vimrc
From Vim Tips Wiki
Tip 807 Previous Next Created: October 22, 2004 Complexity: basic Author: zzapper Version: 5.7
[edit] Backing up vimrc
You can always easily reinstall Vim however the loss of your vimrc file could be a catastrophe!
So remember to back it up in several places. One good place would be to store it as say vimrc.txt, on your free webspace then you can recover it from anywhere. Make sure there is no confidential data in your .vimrc of course.
A further tip is to store as a comment (vi(m) comments begin with a ") a few notes on how you configure FireFox, Cygwin etc for Vim, as these details are easy to forget
[edit] Commenting vimrc
My vimrc now has 348 lines, but about 50% is deadwood because it's no longer clear to me what it's supposed to do. Wish I'd thought of this tip years ago! In vimrc you use the double quote as a comment, for example:
" open search result in a new window (the comment)
map zm :let @/=expand("<cword>") <BAR> split <BAR> execute 'normal n'<CR>
[edit] Comments
One thing that a co-worker turn me on to is storing your home dir in cvs. That way not only can you recover from loss of files, but you can version them, and not have to worry about reconciling changes you made to a file on one machine vs changes you made on another.
It make things incredibly easy to manage and you can configure you environment on a new machine in seconds.
You can also use folds in vimrc, which tends to do wonders for organization and readability as well.
In your vimrc you can read an environment variable to allow different command depending on which OS or PC you're on and thus have same vimrc.
if $USER == 'davidr' echo "on home pc" set .. etc else echo "on work pc" set .. etc endif
