Преглед на файлове

Add statusline to vimrc

Thomas Dy преди 7 години
родител
ревизия
10b3765aa8
променени са 1 файла, в които са добавени 32 реда и са изтрити 0 реда
  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()