Hello,

> Hi,
> 
>  when writing a function in vim script sometimes it makes sense to
>  change options of vim.
> 
>  Are these changes local to the function ?

No, they persist after the function is ended.  As a simple example, you could
use a function like the following to toggle the 'number' option.

  map <F5> :call ToggleNumberOption()<CR>
  function! ToggleNumberOption()
    set number!
  endfunction

You'll see that the ToggleNumberOption function is changing the 'number' option
and the change persists after the function is ended.

>  And if not: Can I simply assign the current value of the option to a 
>  variable, change the option and restore the option value from the
>  value stored in that variable?

Occasionally it is useful to store the value of an option and restore it later.
 You can do it like this:

  " store the value
  let l:old_isk = &iskeyword

  " restore the value
  let &iskeyword = l:old_isk

regards,
Peter



                
____________________________________________________ 
On Yahoo!7 
New Idea: Catch up on all the latest celebrity gossip 
http://www.newidea.com.au

Reply via email to