Vim Tips Wiki
Advertisement

Previous TipNext Tip

Tip: #807 - Backing up and commenting vimrc

Created: October 22, 2004 4:28 Complexity: basic Author: zzapper Version: 5.7 Karma: 3/11 Imported from: Tip#807

Hi,

1) BACKING UP .VIMRC :You can always easily reinstall VIM however the loss of your .vimrc could be a catastrophe!


So remember to variously back it up. One good place is to store it as, say vimrc.txt, on your free webspace then you can recover it from anywhere.


2) 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


e.g.

" open search result in a new window (the comment)

map zm :let @/=expand("<cword>") <BAR> split <BAR> execute 'normal n'<CR>

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.

Anonymous , October 22, 2004 8:16


You can also use folds in .vimrc, which tends to do wonders for organization and readability as well.

sreny at rpyrpgvpjvmneq dot pbz (Rot13ed) , October 24, 2004 12:18


Have a look at at your .vimrc now, is it ordered,commented? do you remember what your maps are supposed to do? How about spring cleaning your .vimrc today? What would happen if you had a disk-crash is it backed up?

Anony--AT--mous.com , October 26, 2004 3:30


I divide my .vimrc (all dot files) into personal/vimrc (in cvs) and work/vimrc (gpl).


anon , October 26, 2004 7:20


In your .vimrc you can read an environment variable to allow different command depending on which O/S 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

zzapper , November 2, 2004 12:07


Advertisement