From d582cb408f0479b5124647d5293b079f29cca8d3 Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Sun, 19 Apr 2015 05:27:24 +0200 Subject: vim: Add custom statusline --- vim/vimrc | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'vim') diff --git a/vim/vimrc b/vim/vimrc index 8e4aa8e..23e562e 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -90,3 +90,36 @@ autocmd InsertLeave * match ExtraWhitespace /\s\+$/ autocmd BufWinLeave * call clearmatches() highlight Comment cterm=italic + + +"" Statusline + +set statusline= +set statusline+=[%n] " Buffer number +set statusline+=%<\ " Where to truncate +set statusline+=%.99f " Relative path to file +set statusline+=\ %y " Filetype flag, [c]; [help] +set statusline+=%w " Preview window flag, [Preview] +set statusline+=%m " Modified flag, [+]; [-] + +" Show a warning if file is read only, [RO] +set statusline+=%#identifier# +set statusline+=%r +set statusline+=%* + +" Show a warning if file format isn’t unix +set statusline+=%#warningmsg# +set statusline+=%{&ff!='unix'?'['.&ff.']':''} +set statusline+=%* + +" Show a warning if file encoding isn’t utf-8 +set statusline+=%#warningmsg# +set statusline+=%{(&fenc!='utf-8'&&&fenc!='')?'['.&fenc.']':''} +set statusline+=%* + +"" Right side of statusline +set statusline+=%= " Left/right separation point +set statusline+=%-15.((%l,%c-%v)\ %) " Line, column, percentage. (20,0) +set statusline+=%P " Percentage visible + +set laststatus=2 " Always show statusline -- cgit v1.2.3-54-g00ecf