Le 18 mars 2012 20:42, Gary Johnson <[email protected]> a écrit :

> Yes there is.  You can set 'statusline' to a string that includes a
> function call and have that function return a window-local or
> buffer-local variable.
>
> For example:
>
>    let &statusline='%<%f %(%h%m%r %)%=%{TagName()}'
>
>    function! TagName()
>        if exists('w:tag_name')
>            return w:tag_name
>        else
>            return ''
>        endif
>    endfunction
>
> This technique is used in the ctags.vim plugin,
> http://vim.sourceforge.net/scripts/script.php?script_id=610
>
> If you need the statusline to show the value of &modified, just
> include that value in the string returned by the function.  Vim
> updates the statusline at least every time the cursor moves.
>
> Regards,
> Gary


Hello,

Thank you for your answer.

That is not what I wanted to do.

To solve the problem I hack something like that :
function! StatusLineSet()
    if (&modified)
        setlocal statusline=%1*\ %f\ %2*%=\ %7*\ ✖\ %4*\
<%{&encoding}:%{&fileformat}>\ %5*\ %r%y\ %6*\ %cc,%lL/%LL\ %3p%%
    else
        setlocal statusline=%1*\ %f\ %2*%=\ %8*\ ✔\ %4*\
<%{&encoding}:%{&fileformat}>\ %5*\ %r%y\ %6*\ %cc,%lL/%LL\ %3p%%
    endif
endfunction

au CursorMoved,CursorMovedI,BufWritePost * :call StatusLineSet()

Thank you all for your help.

-- 
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