From 87c73b77964b582900c50308eddd9518948eb895 Mon Sep 17 00:00:00 2001 From: Adam Hovorka Date: Sun, 7 Oct 2018 09:54:18 -0600 Subject: Customize vim statusline --- base/vimrc | 49 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 11 deletions(-) (limited to 'base/vimrc') diff --git a/base/vimrc b/base/vimrc index befd96e..0d3871c 100644 --- a/base/vimrc +++ b/base/vimrc @@ -61,14 +61,10 @@ set wrap "set textwidth=79 "set formatoptions=tqrn1 set colorcolumn=85 -set ruler set number set relativenumber -set laststatus=2 -set shortmess=aoOstTWAI set cursorline -"set showmode -set showcmd +set shortmess=aoOstTWAI set title " change the terminal's title set scrolloff=3 @@ -88,6 +84,38 @@ set ttyfast hi ColorColumn ctermbg=18 hi Folded ctermbg=0 ctermfg=12 +" Statusline ====---- +function! StatusGitInfo() + let git = gitbranch#name() + if git != '' + return ' '.git.' ' + else + return '' +endfunction + +"set ruler +set showmode +set showcmd +set laststatus=2 +set statusline= +"set statusline+=\ S%{strftime('%R',\ getftime(expand('%')))} " Time when last saved +set statusline+=%1*\ %2*%<\ " Cut at start +set statusline+=%3*%f " Path +set statusline+=%{&modified?'\ +':''} " Modified +set statusline+=%{&ro?'\ ':''} " Read only +set statusline+=%{&paste?'\ P':''} " Paste mode +"set statusline+=[%n%H%M%R%W]\ " flags and buf no +set statusline+=%4*%=%3*\ " Section break +set statusline+=%{&ff=='unix'?'':&ff\ } " Line ending +set statusline+=%l\ %c\ %P\ " Line column percent +set statusline+=%2*%1*%{StatusGitInfo()}\ " Git branch +" ^Vue0b0 + +hi User1 ctermfg=020 ctermbg=019 +hi User2 ctermfg=019 ctermbg=018 +hi User3 ctermfg=020 ctermbg=018 +hi User4 ctermfg=018 ctermbg=000 + " Stop using arrow keys ====---- " noremap " noremap @@ -138,13 +166,13 @@ nnoremap q gqip nnoremap vp `[V`] nnoremap h :syntax sync fromstart nnoremap l :nohlsearch:diffupdate:syntax sync fromstart -nnoremap l :nohlsearch:diffupdate:syntax sync fromstart nnoremap [ :put! =repeat(nr2char(10), v:count1)'[ nnoremap ] :put =repeat(nr2char(10), v:count1) noremap y "+y noremap yy "+Y noremap p :set paste:put +:set nopaste +vnoremap p "_dP noremap + :s/^\s*/&\/\//:noh noremap - :s/^\(\s*\)\/\//\1/:noh @@ -152,7 +180,9 @@ noremap - :s/^\(\s*\)\/\//\1/:noh vnoremap Q gq nnoremap Q gqap -cnoremap w!! w !sudo tee % >/dev/null +cnoremap w!! %!sudo tee % >/dev/null +cnoremap +cnoremap " helper function to toggle hex mode function! ToggleHex() @@ -231,9 +261,6 @@ au BufNewFile,BufRead * call SetLocalOptions(bufname("%")) " To move elsewhere ====---- au BufNewFile,BufRead *.less set filetype=less autocmd! BufWritePost $MYVIMRC source $MYVIMRC -packadd! matchit -cnoremap -cnoremap autocmd! BufRead,BufNewFile *.md set filetype=markdown autocmd! BufRead,BufNewFile *.md set spell -vnoremap p "_dP +packadd! matchit -- cgit v1.2.3-70-g09d2