On 20 fév, 00:03, Gary Johnson <[email protected]> wrote: > On 2010-02-19, epanda wrote: > > Hi, > > > I use those func to change statusline but when I want to restore > > initial statusline format , it fails. > > > 1/ InitStatusLine > > > function! InitStatusLine(taskName) > > > " > > let g:savedStatusLine = &statusline > > <<<<<<<<<<<<<< save initial status line > > > " > > if &laststatus != 2 > > set laststatus=2 > > endif > > let s:statusTask = a:taskName > > let s:statusXtraInfo = '' > > > call s:StatusLineTaskUpdate(a:taskName . ' | Progress:') > > setlocal statusline=%{DefineStatusLine()} > > > endfunction > > > function! s:StatusLineTaskUpdate(msg) > > let s:statusTask = a:msg > > redrawstatus > > endfunction > > > function! DefineStatusLine() > > return s:statusTask. " -- ". s:statusXtraInfo > > endfunction > > > 2/ > > > function! RestoreStatusLine() > > " call WaitingFunc(1000) > > let &statusline = g:savedStatusLine > > endfunction > > > Why my statusline is not reset ? > > Because you're saving and restoring the global value of > 'statusline', but your InitStatusLine() function is setting a > window-local value of 'statusline', which takes precedence over the > global value. > > If you need to use local values of 'statusline', you'll have to save > and restore each local value individually. If you want to restore > the statusline in a particular window to the appearance of the > global 'statusline' value, you can just clear the local value, e.g. > > setlocal statusline= > > Regards, > Gary
Thank you Gary -- You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php
