dotfiles/.vimrc

164 lines
4.7 KiB
VimL
Raw Normal View History

2021-05-27 17:54:53 +02:00
" Vundle
filetype off
" Set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
" Download plug-ins to the ~/.vim/plugged/ directory
call vundle#begin('~/.vim/plugged')
2021-08-31 13:08:37 +02:00
" Let Vundle manage Vundle; muss immer der erste Eintrag sein
2021-06-01 17:44:59 +02:00
Plugin 'VundleVim/Vundle.vim'
" languagepack
2021-08-12 13:30:31 +02:00
Plugin 'sheerun/vim-polyglot'
2021-05-31 20:44:56 +02:00
" fuzzy finder
2021-08-12 13:30:31 +02:00
Plugin 'ctrlpvim/ctrlp.vim'
2021-05-31 20:44:56 +02:00
" git integration G:
2021-08-12 13:30:31 +02:00
Plugin 'tpope/vim-fugitive'
2021-08-10 12:42:11 +02:00
" auto einrueckung
2021-08-12 13:30:31 +02:00
Plugin 'tpope/vim-sleuth'
2021-05-27 17:54:53 +02:00
call vundle#end()
2021-06-01 17:44:59 +02:00
2021-08-31 13:08:37 +02:00
" ### allgemeine Optionen
" ### Suche
" While typing a search command, show immediately where the so far typed pattern matches.
set incsearch
" global bei suche immer mit an
set gdefault
" When there is a previous search pattern, highlight all its matches.
set hlsearch
" Ignore case in search patterns.
set ignorecase
" Override the 'ignorecase' option if the search pattern contains upper case characters.
set smartcase
" ### Nummern
" Show line numbers.
set number
" toggle linenumbers
nmap <C-n> :set nonu!<CR>
" ### Kommandovervollständigung
" https://www.reddit.com/r/vim/comments/oo9gms/any_way_to_get_vim_to_not_defaulting_to_the_first/h5wygix/?context=8&depth=9
set wildmode=longest,list,full
set wildmenu
set wildignore=*.o,*~
" ### Rest
" Show (partial) command in status line.
set showcmd
2021-06-01 17:44:59 +02:00
set virtualedit=onemore
set encoding=UTF-8
set visualbell
set ruler
set undolevels=1000
set backspace=indent,eol,start
2021-08-31 13:08:37 +02:00
" ermögliche das bearbeitete buffer in der hintergrund können
set hidden
" verhindert zeilenumbrüche
set nowrap
2021-08-15 12:42:20 +02:00
set showbreak=+++
2021-08-31 13:08:37 +02:00
" https://vim.fandom.com/wiki/Automatic_word_wrapping
set wrap linebreak
" Enable syntax highlighting
syntax on
" Enable mouse drag on window splits
set mouse=a
" https://unix.stackexchange.com/questions/12535/how-to-copy-text-from-vim-to-an-external-program
set clipboard=unnamedplus
" zeige "matching" klammer usw.
set showmatch
2021-06-01 17:44:59 +02:00
2021-08-31 13:08:37 +02:00
" ### Plugins"
" ### ripgrep und ctrlp
2021-05-27 17:54:53 +02:00
" sudo apt install ripgrep(rg)
if executable('rg')
let g:ctrlp_user_command = 'rg %s --files --hidden --color=never --glob ""'
2021-10-06 19:49:30 +02:00
else
let g:ctrlp_user_command = 'find %s -type f'
2021-05-27 17:54:53 +02:00
endif
2021-08-20 07:14:18 +02:00
" let g:ctrlp_map = '<c-f>' "aufruf mit strg+f
2021-08-20 18:03:24 +02:00
nmap <C-f> :CtrlP<CR>
2021-05-27 17:54:53 +02:00
" ignore files
" https://github.com/ctrlpvim/ctrlp.vim
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe " Windows
2021-05-28 13:26:56 +02:00
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
2021-08-24 08:57:21 +02:00
" stelle standard keybinding um
let g:ctrlp_map = ''
2021-05-31 19:56:37 +02:00
2021-08-31 13:08:37 +02:00
" ### Keybindings
" deaktiviere Ex-Mode keybinding
:nnoremap Q <Nop>
2021-08-31 13:08:37 +02:00
" Ctrl+S zum speichern
nmap <C-s> :w<CR>
" ctrl+W zum schließen
nmap <C-w> :q<CR>
" ctrl+P: set paste
nmap <C-p> :set paste!<CR>
" ctrl+t fuer neuen tab
nmap <C-t> :tabnew<CR>
" leader-key
:let mapleader = ","
2021-09-13 08:25:10 +02:00
" vim.fugitiv in neuem tab
2021-09-19 13:02:37 +02:00
nmap <C-g> :tab G
2021-09-14 09:57:16 +02:00
" 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
2021-10-07 10:10:20 +02:00
" ### 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={
2021-10-08 08:16:41 +02:00
\ '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 '
2021-10-08 10:48:32 +02:00
\}