On Tue, Oct 03, 2006 at 10:00:51PM -0700, Hari Krishna Dara wrote:
>
> Yegappan already answered your question. However, in case you want to do
> the whole of it in the same function, I recommend the below pattern:
>
> let _ic = &ignorecase
> set noic
> try
> " do something
> finally
> let &ignorecase = _ic
> endtry
So far, I have been too lazy to use try/finally/endtry. I guess
the point is that if the "do something" generates an error, then the
option is still restored? (Of course, my vim scripts never generate
errors. ;)
Another refinement is to avoid setting the global option. Use
&l:ignorecase to access (read and write) the local value of the option.
If the option happens to be global, I do not think using the "l:" prefix
will cause any problems.
HTH --Benji Fisher