Thursday, May 6, 2010

Re: au BufReadPost * if &readonly | set nomodifiable

On May 4, 11:43 pm, rudy_b <rudyke...@yahoo.com> wrote:
> Hi,
> I have included the autocmd (listed below) in my .vimrc file.
>  au BufReadPost * if &readonly | set nomodifiable
>
> The intention is to not let gvim even modify the read only files

By the way, the reason I use this behavior, is that I use a version-
control system at work that requires a lock of a file before making
any changes. Without the lock, the file shows as readonly. Before I
added the autocmd I gave (not the broken one above!), I would often
make changes, fail to notice the warning that I was modifying a
readonly file, and go to :w, which would always fail. :w! doesn't even
work, since I don't have a lock. Acquiring the lock makes Vim thinks
the file has changed (and indeed, since I don't have a lock, it may
have changed in truth), so I found it best just to always set
nomodifiable until I have the lock.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: