Hi,
The following code makes vim crash sometimes.
fun! MakeVimCrash()
redir => lets
silent let
redir END
endf
call MakeVimCrash()
It doesn't crash always. Sometimes I have to call the function twice.
I now ran a few more tests. It appears that vim is more likely to crash
when loading more plugins. When I remove plugins, I can call the
function more often. I'm not able to pin it down this problem to one
specific plugin though.
BTW, this is part of the following function:
fun! ResetOption(name)
if empty(a:name)
redir => lets
silent let
redir END
let options = split(lets, "\n")
call filter(options, 'v:val =~ ''^[^_]\+_default\s''')
call map(options, 'matchstr(v:val, ''^[^_]\+\ze_default\s'')')
call filter(options, 'exists("&".v:val)')
else
let options = split(a:name, '\W\+')
endif
for name in options
let name0 = 'g:'. name .'_default'
if exists(name0)
exec 'let &'. name .' = '. name0
endif
endfor
endf
command! -nargs=* ResetOption :call ResetOption(<q-args>)
Use it like this (eg to deal with misbehaving plugins changing global
options):
let g:tabstop_default = 4
let &tabstop = g:tabstop_default
let &tabstop = 8
ResetOption
Unfortunately :set doesn't provide a way to (re)set user-defined default
values, it seems.
Regards,
Thomas.