Bee Said:
>
>
> On Dec 22, 6:52 pm, stardiviner <numbch...@gmail.com> wrote:
> > I want to make a condition in statusline setting.
> > for example: when fileformat is unix, show "unix" with black color in statusline, if fileformat is
> > "dos", then show in statusline with *red* color.
> > here is my statusline setting in my vimrc file:
> >
> > <code>
> > " item form: %-0{minwid}.{maxwid}{item} --> minwid: min-width,
> > " %4 width, %-4 padding on the right instead of the left. %= switch to right side.
> > " %04l pad with zeros instead of spaces. like 0012.
> > " %.20F change the maximum width. The path will be truncated if necessary: <hapters/17.markdown.
> > " Require: fugitive, current-func-info,
> > set statusline=\%#StatusSeparator#\|\%#StatusBufferNumber#\b\:%n\%#StatusSepara tor#\|
> > \\%#StatusReadOnly#\ \%r\ \%#StatusModFlag#\%m\ \%#StatusList#\%q
> > \\ %=\ %<%-15(\%#StatusNormal#\%{&ff}\%#StatusChar#\X\%#StatusNormal#\%{&fenc}%)
> > \\ \%#StatusChar#\X\ \%#StatusLineNumber#\%-(L:%l/%L\ C:%c%V%)\ \%#StatusPercent#\%P
> > "" FIXME write this function.
> > "function StatusLineFileFormat(ff)
> > "if &ff == 'unix'
> > "return a:ff
> > "elseif &ff == 'dos'
> > "return a:ff " show with red color in statusline.
> > "endif
> > "endfunction
> > </code>
> >
> > I do not know vimscript language, so I do not know how to write upper StatusLineFIleFormat()
> > function. :P
> >
> > -->> stardiviner << =>GPG: 5D9F64D8 Twitter: @numbchild
> >
> > http://stardiviner.dyndns-blog.com/author.html
> >
> > signature.asc
> > < 1KViewDownload
>
> I know you were asking for colors, this is another way:
>
> set statusline+=%{strpart(&ff,0,1)} " fileformat
>
> In my statusline that is the last item and is right justified.
> It displays only the first character of either unix, dos, or mac,
> leaving room for other status info.
>
> &ff is the fileformat variable
> strpart returns 1 char starting with the first (0 based)
>
> -Bill
>
I try to search those similar project on Internet, I found powerline on github, maybe I can find
something in this. If you have interest in this, you can reference that.
Thanks for upper two guys, Just like first one said, it is a little hard to implement.
> --
> 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
>
--
>> stardiviner << =>GPG: 5D9F64D8 Twitter: @numbchild
http://stardiviner.dyndns-blog.com/author.html
No comments:
Post a Comment