VIM: Significant style changes to statusline

I have used colour and powerline symbols to differentiate different
parts of my status line.

Inspiration came from this:
https://www.reddit.com/r/vimporn/comments/kbtu74/my_theme_called_humanoid_and_my_statusbar/
Jonathan Hodgson 4 years ago
parent 6feffc731b
commit 23f2116f9d
  1. 133
      nvim/.config/nvim/plugin/statusline.vim

@ -1,36 +1,107 @@
" Always show a statusline " Always show a statusline
set laststatus=2 set laststatus=2
" Make it empty so we can add to it " Get current filetype
set statusline= function! CheckFT(filetype)
" Space character if a:filetype == ''
set statusline+=\ return '-'
" Short file name else
set statusline+=%f return tolower(a:filetype)
" Space character endif
set statusline+=\ endfunction
" Read only flag
set statusline+=%r " set colors for statusline based on mode
" Space character function! DetectMode(mode)
set statusline+=\ if empty($DISPLAY)
" Modified flag let left=""
set statusline+=%m let right=""
else
let left=""
let right=""
end
let statusline=""
" Mode
if a:mode == 'n'
let statusline .= "%#GruvboxBg4#\ " . left
let statusline .= "%#PmenuThumb#NORMAL"
let statusline .= "%#GruvboxBg4#" . right . "\ "
elseif a:mode == 'i'
let statusline .= "%#GruvboxBlue#\ " . left
let statusline .= "%#PmenuSel#INSERT"
let statusline .= "%#GruvboxBlue#" . right . "\ "
elseif a:mode == 'R'
let statusline .= "%#GruvboxRed#\ " . left
let statusline .= "%#DiffDelete#REPLACE"
let statusline .= "%#GruvboxRed#" . right . "\ "
elseif a:mode ==# 'v'
let statusline .= "%#GruvboxAqua#\ " . left
let statusline .= "%#DiffChange#VISUAL"
let statusline .= "%#GruvboxAqua#" . right . "\ "
elseif a:mode ==# 'V'
let statusline .= "%#GruvboxAqua#\ " . left
let statusline .= "%#DiffChange#VISUAL"
let statusline .= "%#GruvboxAqua#" . right . "\ "
elseif a:mode ==# ''
let statusline .= "%#GruvboxAqua#\ " . left
let statusline .= "%#DiffChange#VISUAL"
let statusline .= "%#GruvboxAqua#" . right . "\ "
elseif a:mode ==# 'c'
let statusline .= "%#GruvboxBg2#\ " . left
let statusline .= "%#Pmenu#COMMAND"
let statusline .= "%#GruvboxBg2#" . right . "\ "
elseif a:mode ==# 't'
let statusline .= "%#ModeTFGCS#\ " . left
let statusline .= "%#ModeTFGC#\ TERMINAL\ "
let statusline .= "%#ModeTFGCS#" . right . "\ " . left
let statusline .= "%#ModeTFGC#%[%n\ ̷%{bufnr('$')}\ "
elseif a:mode == 's' || a:mode == 'S' || a:mode == '^S'
let statusline .= "%#GruvboxAqua#\ " . left
let statusline .= "%#DiffChange#VISUAL"
let statusline .= "%#GruvboxAqua#" . right . "\ "
endif
" Filename
" grey = normal
" aqua = modified
" red = read only and not modified
if &mod == 1
let statusline .= "%#GruvboxAqua#\ " . left
let statusline .= "%#DiffChange#%.20f"
let statusline .= "%#GruvboxAqua#" . right . "\ "
else
if &readonly == 1
let statusline .= "%#GruvboxRed#\ " . left
let statusline .= "%#DiffDelete#%.20f"
let statusline .= "%#GruvboxRed#" . right . "\ "
else
let statusline .= "%#GruvboxBg4#\ " . left
let statusline .= "%#PmenuThumb#%.20f"
let statusline .= "%#GruvboxBg4#" . right . "\ "
endif
endif
" Seperator " Seperator
set statusline+=%= let statusline .= "%="
" Git branch
set statusline+=%{FugitiveStatusline()} " git branch
" Space character if exists("*FugitiveHead")
set statusline+=\ let statusline .= "%#GruvboxBg4#\ " . left
" column number let statusline .= "%#PmenuThumb#%{FugitiveHead()}"
set statusline+=%c let statusline .= "%#GruvboxBg4#" . right . "\ "
set statusline+=: endif
" Line number
set statusline+=%l
" Literal `/`
set statusline+=/
" Total number of lines
set statusline+=%L
" Space character
set statusline+=\
" Filetype " Filetype
set statusline+=%y let statusline .= "%#GruvboxBlue#\ " . left
let statusline .= "%#PmenuSel#%{CheckFT(&filetype)}"
let statusline .= "%#GruvboxBlue#" . right . "\ "
" Cursor location and file length
let statusline .= "%#GruvboxYellow#\ " . left
let statusline .= "%#Search#%c:%l\ %#IncSearch#\ %L"
let statusline .= "%#GruvboxOrange#" . right . "\ "
return statusline
endfunction
set statusline=%!DetectMode(mode())

Loading…
Cancel
Save