godlygeek / csapprox

Make gvim-only colorschemes work transparently in terminal vim
http://www.vim.org/scripts/script.php?script_id=2390
211 stars 18 forks source link

Properly keep global vars for unlet/re-let cycle #4

Closed graywh closed 13 years ago

graywh commented 13 years ago

"let var_name" will change the value of the global variable of the same name if it exists. Instead, use a local variable to temporary store 'colors_name' and 'syntax_cmd'.

graywh commented 13 years ago

Even after fixing that error, it doesn't seem to help with g:colors_name disappearing after changing 'bg'.

godlygeek commented 13 years ago

How did Bram let a change that's so backwards incompatible slip through!? Are you sure that's a feature and not a bug? I'll try to build a vim 7.3 sometime soon to QC this...

graywh commented 13 years ago

I get the same behavior in 7.2.330 and 7.0.305. That is,

let g:var = "foo" let var = "baz" " now g:var is 'baz'

godlygeek commented 13 years ago

Sure, that's a very different case than what you originally said, since you're actually in the global scope there (from what you showed, at least)... You said that this would change the global: let var = "foo" function! LocalVar() let var = "bar" endfunction echo var

In my currently available vim (vim 7.2.000), that prints "foo" as expected. It sounds like you're saying it prints "bar" in some versions of vim...

graywh commented 13 years ago

Oh, ok. That means something else is unlet-ing g:color_names when changing 'bg'.