Fandom

Vim Tips Wiki

Protecting a file from accidental changes

1,624pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Tip 426 Printable Monobook Previous Next

created 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.

CommentsEdit

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

// vim:noma

Also on Fandom

Random Wiki