Wikia

Vim Tips Wiki

Protecting a file from accidental changes

Talk0
1,613pages on
this wiki
Revision as of 01:27, April 25, 2008 by JohnBot (Talk | contribs)

Tip 426 Printable Monobook Previous Next

created February 13, 2003 · complexity basic · author zzapper · version 5.7


A common programmimg situation, you are comparing two versions of the same file. One is the "reference file" which you don't want to update. However they look so similar that you can get confused.

Solution: Set the master file to read only, and change its color scheme.

:set nomodifiable
:colorscheme peachpuff

Non-modifiable is better than :set ro as nomodifiable won't even let you start changing stuff, whereas :set ro will only warn you once.

Comments

You can permanently protect a file by setting a suitable modeline :help modeline.

// vim:noma

Around Wikia's network

Random Wiki