Bladeren bron

Add statusline to vimrc

Thomas Dy 7 jaren geleden
bovenliggende
commit
10b3765aa8
1 gewijzigde bestanden met toevoegingen van 32 en 0 verwijderingen
  1. 32 0
      .vimrc

+ 32 - 0
.vimrc

@@ -154,3 +154,35 @@ augroup end
 if filereadable(expand('~/.vimrc.local'))
   source ~/.vimrc.local
 endif
+
+highlight StatusLine cterm=NONE ctermbg=8
+highlight StatusLineNC cterm=NONE ctermbg=0
+highlight StatusLineModeInsert ctermbg=14 ctermfg=0
+highlight StatusLineModeVisual ctermbg=3 ctermfg=0
+highlight StatusLineModeNormal ctermbg=11 ctermfg=0
+
+function GetMode()
+  let m = mode()
+  " echom m
+  if m ==# 'i'
+    return '%#StatusLineModeInsert# I '
+  elseif m =~# '\(v\|V\|\)'
+    return '%#StatusLineModeVisual# V '
+  else
+    return '%#StatusLineModeNormal# N '
+  endif
+endfunction
+
+function StatusLine()
+  let line=''
+  let line.=GetMode()
+  let line.='%*%< %f %h%m%r'
+  let line.='%='
+  " let line.='%-14.(%l,%c%V%) %P'
+  let line.=' %y '
+  let line.=' %{&fenc}[%{&ff}]'
+  let line.=' %3p%% %7(%l/%L%): %3(%c%V%) '
+  return line
+endfunction
+
+set statusline=%!StatusLine()