I wanted to save the current setting for an option so I could change
that option temporarily then set it back to what it was. Specifically,
I'm using the Cfname.vim plugin and it hard sets the statusline option
then hard sets it back. I already improved it to work "on demand" by
creating a toggle to turn it on and off. I wanted to improve it further
by storing the user's current statusline setting when toggling it on
then restoring the statusline setting when toggling it off. I was going
to ask in this list how to do this but I ended up figuring it out on my
own. I'll go ahead and post my solution in case someone finds it
useful. This seems to work but if anyone can see any problems with this
or a better way to do it, please let me know.
"save user's current statusline option
let g:CF_statusline=escape(getbufvar(1, "&statusline"), " ")
"set statusline back to previous setting
execute 'set statusline=' . g:CF_statusline
Jason Aeschilman