Le 19 mars 2012 10:24, Jürgen Krämer <[email protected]> a écrit :

> It seems you are not allowed to pass any arguments to you StatusLine()
> function inside the 'statusline' option. But even if you define
> StatusLine() someway like
>
>  function! StatusLine()
>      if &l:modified
>           return '%1* %f %2*%= %7* ✖ %4* <%{&encoding}:%{&fileformat}>%5*
> %r%y %6* %cc,%lL/%LL %3p%%'
>      else
>          return '%1* %f %2*%= %8* ✔ %4* <%{&encoding}:%{&fileformat}>%5*
> %r%y %6* %cc,%lL/%LL %3p%%'
>      endif
>  endfunction
>
>   set statusline=%!StatusLine()
>
> this would probably not work, because &l:modified is evaluated in the
> context of the current buffer.
>
It makes the same problems of my old solutions.

You can circumvent those problems by always using both highlight groups.
> You just have to make sure you return an empty string if the highlight
> group should not be used for the current modified state:
>
>  set statusline=%1*\ %f\ %2*%=\
> %7*%{&modified?'✖':''}%8*%{&modified?'':'✔'}\ %4*\
> <%{&encoding}:%{&fileformat}>\ %5*\ %r%y\ %6*\ %cc,%lL/%LL\ %3p%%
>
Doesn't work and X/V are vertically cut.

But, my solution works well.
In fact I can give parameters but statusline is a window variable and it
seems that all the SL are refreshed when the SL is a function but not when
the SL is a normal variable.

Thanks for all

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to