Use a custom status line and buftabline. Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
84 lines
2.2 KiB
VimL
84 lines
2.2 KiB
VimL
augroup UserStatusline
|
|
autocmd!
|
|
autocmd BufEnter,WinEnter,TermOpen * setlocal statusline=%!ActiveStatus()
|
|
autocmd WinLeave * setlocal statusline=%!PassiveStatus()
|
|
augroup END
|
|
|
|
augroup UserStatusLineColors
|
|
autocmd!
|
|
autocmd ColorScheme *
|
|
\ hi User1 guifg=DarkRed guibg=Black |
|
|
\ hi User2 guifg=White guibg=Black |
|
|
\ hi User3 guifg=Cyan guibg=Black |
|
|
\ hi User4 guifg=Orange guibg=Black |
|
|
\ hi User5 guifg=Red guibg=Black |
|
|
\ hi User6 guifg=Gray guibg=Black |
|
|
\ hi User7 guifg=Gray guibg=Black |
|
|
\ hi User8 guifg=DarkYellow guibg=Black
|
|
augroup END
|
|
|
|
function! GitInfo()
|
|
let git = fugitive#head()
|
|
if git != ''
|
|
return ' '.fugitive#head()
|
|
else
|
|
return ''
|
|
endfunction
|
|
|
|
" https://nest.pijul.com/tae/setup:master/
|
|
function! GetCursorPosition()
|
|
if &buftype == ''
|
|
let l:position = getcurpos()
|
|
return l:position[1] . 'Ⲷ ' . l:position[2] . 'Ⲽ'
|
|
endif
|
|
|
|
return &buftype ==# 'quickfix'
|
|
\ ? line('.') . '/' . line('$')
|
|
\ : ''
|
|
endfunction
|
|
|
|
function! GetFileDir()
|
|
if &buftype != ''
|
|
return ''
|
|
endif
|
|
|
|
if &filetype ==# 'gitcommit'
|
|
return 'New commit on '
|
|
endif
|
|
|
|
if &filetype ==# 'gitrebase'
|
|
return 'Interactive rebase on '
|
|
endif
|
|
|
|
let l:path = expand('%:h')
|
|
return len(l:path) > 0 ? l:path : ''
|
|
endfunction
|
|
|
|
function! ActiveStatus() abort
|
|
let statusline=""
|
|
let statusline.="%1*\ %{winnr()}\ "
|
|
let statusline.="%2*\ %{GitInfo()}"
|
|
let statusline.="%2*\ %Y\ "
|
|
let statusline.="%3*%<%{GetFileDir()}"
|
|
let statusline.="%="
|
|
let statusline.="%4*\ %{GetCursorPosition()}\ (%3p%%)"
|
|
return statusline
|
|
endfunction
|
|
|
|
function! PassiveStatus() abort
|
|
let statusline=""
|
|
let statusline.="%5*\ %{winnr()}\ "
|
|
let statusline.="%6*\ %{GitInfo()}"
|
|
let statusline.="%6*\ %Y\ "
|
|
let statusline.="%7*%<%{GetFileDir()}"
|
|
let statusline.="%="
|
|
let statusline.="%8*\ %{GetCursorPosition()}\ (%3p%%)"
|
|
return statusline
|
|
endfunction
|
|
|
|
set statusline=%!ActiveStatus()
|
|
" The colorscheme needs to be set here as it seems the autocmd group handling
|
|
" color scheme must always be defined before the colorscheme is set else the
|
|
" custom highlighting color groups for status line do not seem to take effect.
|
|
colorscheme gruvbox8_hard
|