Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

VI annoyance



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






BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org