... modified to show the full "fold-tree" like here:
http://s13.postimg.org/9tql8bpzb/statusline.png
highlight link StatFname StatusLine
highlight link StatFenc StatusLineNC
highlight link StatPath LineNr
highlight link StatLnum StatusLineNC
highlight link StatFnameINS StatusLine
highlight link StatFencINS StatPath
highlight link StatPathINS ModeMsg
highlight link StatLnumINS StatPath
highlight link StatFnameNC StatusLineNC
highlight link StatFencNC StatFnameNC
highlight link StatPathNC StatFnameNC
highlight link StatLnumNC StatFnameNC
set laststatus=2
set lazyredraw
set foldenable
set foldmethod=marker
let &statusline = "%!StatusLine( '' )"
function StatusLine( mode )
let statusline = '%#StatFname' . a:mode . '#'
let statusline .= '%w%t%r%m '
let statusline .= '%#StatFenc' . a:mode . '# '
let statusline .= '[' . (&binary ? 'binary' : (&fenc . (&bomb ? '-bom' : ''))) . ' ' . &ff . '] '
let statusline .= '%#StatPath' . a:mode . '# '
let statusline .= '%<'
let path = expand( '%:p:h' ) . (has( 'win32' ) ? '\' : '/')
let level = foldlevel( '.' )
let closed = foldclosed( '.' )
if (a:mode == 'INS') && (level > 0)
let save_foldtext = &foldtext
set foldtext=StatFoldText()
foldclose!
let i = 0
let delim = ''
while i < level
let statusline .= delim . foldtextresult( foldclosed( '.' ) )
foldopen
let i += 1
let delim = ' >> '
endwhile
if closed >= 0
foldclose
endif
let &foldtext = save_foldtext
else
let statusline .= path
endif
let statusline .= '%='
let statusline .= '%#StatLnum' . a:mode . '# '
let statusline .= '%3v | %5l/%L (%3p%%)'
return statusline
endfunction
function StatFoldText()
return substitute( foldtext(), '^.\{-}: \|\s\+$', '', 'g' )
endfunction
autocmd WinEnter,InsertLeave * let &l:statusline = "%!StatusLine( '' )"
autocmd InsertEnter,InsertChange * let &l:statusline = "%!StatusLine( 'INS' )"
autocmd WinLeave * let &l:statusline = "%!StatusLine( 'NC' )"
--
--
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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Monday, December 30, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment