VI annoyance
Doug
dougsweetser-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Wed Aug 11 12:20:58 EDT 2010
When I made the switch from emacs to vim last year, one thing I missed
was the name of the file at the bottom of a terminal screen. I keep
LOTS of windows open, and cannot recall which file is being worked on.
This bit gives a nice status report:
" status bar copied from http://dotfiles.org/~gregf/.vimrc
set laststatus=2
set statusline=
set statusline+=%2*%-3.3n%0*\ " buffer number
set statusline+=%f\ " file name
if has("eval")
let g:scm_cache = {}
fun! ScmInfo()
let l:key = getcwd()
if ! has_key(g:scm_cache, l:key)
if (isdirectory(getcwd() . "/.git"))
let g:scm_cache[l:key] = "[" .
substitute(readfile(getcwd() . "/.git/HEAD", "", 1)[0],
\ "^.*/", "", "") . "] "
else
let g:scm_cache[l:key] = ""
endif
endif
return g:scm_cache[l:key]
endfun
set statusline+=%{ScmInfo()} " scm info
endif
set statusline+=%h%1*%m%r%w%0* " flags
set statusline+=\[%{strlen(&ft)?&ft:'none'}, " filetype
set statusline+=%{&encoding}, " encoding
set statusline+=%{&fileformat}] " file format
set statusline+=%= " right align
set statusline+=%-14.(%l,%c%V%)\ %<%P " offset
Glad I did not have to figure this out :-)
Doug
More information about the Discuss
mailing list