vim: statusline durch lightline ersetzt

This commit is contained in:
Michael Grote 2021-11-09 09:59:07 +01:00
parent a972df3438
commit 9109d5faa0

62
.vimrc
View file

@ -14,6 +14,8 @@ Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'tpope/vim-fugitive'
" auto einrueckung
Plugin 'tpope/vim-sleuth'
" statusline
Plugin 'itchyny/lightline.vim'
call vundle#end()
@ -108,56 +110,16 @@ function! GitBranch()
return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
endfunction
" ### Statuszeile
" https://stackoverflow.com/questions/56274737/what-is-the-return-value-for-visual-block-mode-in-vimscript
" https://jdhao.github.io/2019/11/03/vim_custom_statusline/
" https://shapeshed.com/vim-statuslines/
" https://jip.dev/posts/a-simpler-vim-statusline/
" https://jordanelver.co.uk/blog/2015/05/27/working-with-vim-colorschemes/
" ### lightline/statusline
" blende insert/visual/... in der commandline aus, steht in lightline
set noshowmode
set laststatus=2
" Funktion git branch
function! StatuslineGit()
let l:branchname = GitBranch()
return strlen(l:branchname) > 0?' '.l:branchname.' ':''
endfunction
set statusline=
set statusline+=%#StatusLineTerm#
set statusline+=%{g:currentmode[mode()]}
set statusline+=%#PmenuSel#
set statusline+=%{StatuslineGit()}
set statusline+=%#ToolButton#
set statusline+=\%f
set statusline+=%#TabLineFill#
set statusline+=%m
set statusline+=%=
set statusline+=\ %y
set statusline+=\ %{&fileencoding?&fileencoding:&encoding}
set statusline+=\ [%{&fileformat}\]
set statusline+=\ %l:%c
set statusline+=\
set statusline+=%{&paste?'PASTE':''}
let g:currentmode={
\ 'n' : ' NORMAL ',
\ 'no' : ' NORMAL-OPERATOR PENDING ',
\ 'v' : ' VISUAL ',
\ 'V' : ' VISUAL-LINE ',
\ "\<C-V>" : ' VISUAL BLOCK ',
\ 's' : ' SELECT ',
\ 'S' : ' SELECT-LINE ',
\ 'x19' : ' SELECT-BLOCK ',
\ 'i' : ' INSERT ',
\ 'R' : ' REPLACE ',
\ 'Rv' : ' VISUAL-REPLACE ',
\ 'c' : ' COMMAND ',
\ 'cv' : ' VIM EX ',
\ 'ce' : ' EX ',
\ 'r' : ' PROMPT ',
\ 'rm' : ' MORE ',
\ 'r?' : ' CONFIRM ',
\ '!' : ' SHELL ',
\ 't' : ' TERMINAL '
\}
let g:lightline = {
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component_function': {
\ 'gitbranch': 'FugitiveHead'
\ },
\ }