vim: statusline2 (#1)
Co-authored-by: Michael Grote <michael.grote@posteo.de> Reviewed-on: #1 Co-authored-by: mg <mg@noreply.git.mgrote.net> Co-committed-by: mg <mg@noreply.git.mgrote.net>
This commit is contained in:
parent
d9b0a980e2
commit
da0062e1fe
1 changed files with 60 additions and 18 deletions
78
.vimrc
78
.vimrc
|
@ -6,8 +6,6 @@ set rtp+=~/.vim/bundle/Vundle.vim
|
|||
call vundle#begin('~/.vim/plugged')
|
||||
" Let Vundle manage Vundle; muss immer der erste Eintrag sein
|
||||
Plugin 'VundleVim/Vundle.vim'
|
||||
" statusline
|
||||
Plugin 'itchyny/lightline.vim'
|
||||
" languagepack
|
||||
Plugin 'sheerun/vim-polyglot'
|
||||
" fuzzy finder
|
||||
|
@ -70,20 +68,6 @@ set clipboard=unnamedplus
|
|||
set showmatch
|
||||
|
||||
" ### Plugins"
|
||||
" ### lightline/statusline
|
||||
" blende insert/visual/... in der commandline aus, steht in lightline
|
||||
set noshowmode
|
||||
set laststatus=2
|
||||
let g:lightline = {
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode', 'paste' ],
|
||||
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
|
||||
\ },
|
||||
\ 'component_function': {
|
||||
\ 'gitbranch': 'FugitiveHead'
|
||||
\ },
|
||||
\ }
|
||||
|
||||
" ### ripgrep und ctrlp
|
||||
" sudo apt install ripgrep(rg)
|
||||
if executable('rg')
|
||||
|
@ -101,9 +85,9 @@ let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
|
|||
" stelle standard keybinding um
|
||||
let g:ctrlp_map = ''
|
||||
|
||||
|
||||
|
||||
" ### Keybindings
|
||||
" deaktiviere Ex-Mode keybinding
|
||||
:nnoremap Q <Nop>
|
||||
" Ctrl+S zum speichern
|
||||
nmap <C-s> :w<CR>
|
||||
" ctrl+W zum schließen
|
||||
|
@ -119,3 +103,61 @@ nmap <C-g> :tab G
|
|||
" markiere text im visual mode; suche dann danach mit // im visual-mode
|
||||
" https://vim.fandom.com/wiki/Search_for_visually_selected_text
|
||||
vnoremap // y/\V<C-R>=escape(@",'/\')<CR><CR>
|
||||
" https://shapeshed.com/vim-statuslines/
|
||||
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/
|
||||
" 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 '
|
||||
\}
|
||||
|
|
Loading…
Reference in a new issue