Vim Tips Wiki
No edit summary
 
m (Protecting a file you're referencing moved to Protecting a file from accidental changes: Page moved by JohnBot to improve title)

Revision as of 09:30, 18 October 2007

Previous TipNext Tip

Tip: #426 - Protecting a file from accidental changes

Created: February 13, 2003 11:42 Complexity: basic Author: zzapper Version: 5.7 Karma: 11/12 Imported from: Tip#426

A common programmimg situation, you are comparing two versions of the same file.


One is the "reference file" which you DONT WANT to update.


However they look so similar that you can get confused.


Solution:

set ro (readonly) in the master file

additionally change it's color scheme (peachpuff is quite a benign one!)


colorscheme peachpuff


look in vim/vim61/colors for available colorschemes

Comments

I would also :set nomodifiable on the reference file.

Anonymous , February 19, 2003 11:15


set noma (non modifiable)

Yes this is better than :set ro as it won't even let you start changing stuff.

set ro will only warn you (once)

zzapper--AT--ntlworld.com , February 22, 2003 6:11


You can permanently protect a file by setting a suitable modeline (:h modeline) // vim:noma

zzapper--AT--ntlworld.com , February 26, 2003 8:21