Sunday, July 31, 2011

Re: Detecting Encrypted File

Reply to message «Detecting Encrypted File»,
sent 19:40:50 31 July 2011, Sunday
by Paul:

if !empty(&key) | set viminfo= | endif
Do not use :setlocal here: viminfo is global option and using :setlocal will
only confuse you as in this case it is not different to :set or :setglobal.

Original message:
> Whenever I read an encrypted file, I want to 'setlocal viminfo='. If I
> always know the name of the file, I can put something like this in .vimrc:
>
> au! BufRead thefile setlocal viminfo=
>
> What if I don't always know the name of the file? Is there some 'if'
> operand that I can use, maybe like this?:
>
> au! BufRead * if &encrypted | setlocal viminfo= | endif
>
> (I'm not sure that syntax is even correct.)

No comments: