dotfiles/.vimrc

135 lines
4.2 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-06-01 17:44:59 +02:00
" Let Vundle manage Vundle; muss immer der erste eintrag sein
2021-08-12 13:30:31 +02:00
2021-06-01 17:44:59 +02:00
Plugin 'VundleVim/Vundle.vim'
" statusline
2021-08-12 13:30:31 +02:00
Plugin 'itchyny/lightline.vim'
2021-06-01 17:44:59 +02:00
" languagepack
2021-08-12 13:30:31 +02:00
Plugin 'sheerun/vim-polyglot'
2021-06-01 17:44:59 +02:00
" buffer wechseln
2021-08-12 13:30:31 +02:00
Plugin 'jeetsukumaran/vim-buffergator'
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-06-01 17:44:59 +02:00
" git integration
2021-08-12 13:30:31 +02:00
Plugin 'jreybert/vimagit'
2021-08-10 12:42:11 +02:00
" auto einrueckung
2021-08-12 13:30:31 +02:00
Plugin 'tpope/vim-sleuth'
2021-08-16 07:35:05 +02:00
" zeilen ein/auskommentieren
Plugin 'tpope/vim-commentary'
2021-05-27 17:54:53 +02:00
call vundle#end()
2021-06-01 17:44:59 +02:00
" allgemeine Optionen
2021-06-10 15:06:10 +02:00
set showcmd " Show (partial) command in status line.
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-15 12:42:20 +02:00
set ignorecase " Ignore case in search patterns.
set smartcase " Override the 'ignorecase' option if the search pattern contains upper case characters.
set nowrap " verhindert zeilenumbrüche
set showbreak=+++
set wrap linebreak " https://vim.fandom.com/wiki/Automatic_word_wrapping
set hlsearch " When there is a previous search pattern, highlight all its matches.
set gdefault " global bei suche immer mit an
set incsearch " While typing a search command, show immediately where the so far typed pattern matches.
2021-06-10 15:06:10 +02:00
set number " Show line numbers.
2021-08-15 12:42:20 +02:00
"https://jeffkreeftmeijer.com/vim-number/
set number relativenumber
augroup numbertoggle
autocmd!
autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
augroup END
" toggle linenumbers
nmap <C-n> :set norelativenumber!<CR>:set nonu!<CR>
2021-08-15 12:42:20 +02:00
2021-06-10 15:06:10 +02:00
syntax on " Enable syntax highlighting
set shiftwidth=4 " Number of spaces to use for each step of (auto)indent.
2021-06-01 17:44:59 +02:00
set mouse=a " Enable mouse drag on window splits
set clipboard=unnamedplus " https://unix.stackexchange.com/questions/12535/how-to-copy-text-from-vim-to-an-external-program
2021-08-15 12:42:20 +02:00
" Keybindings
2021-08-19 11:16:21 +02:00
" Ctrl+S zum speichern
nmap <C-s> :w<CR>
2021-08-19 11:17:51 +02:00
" ctrl+W zum schließen
nmap <C-w> :q<CR>
2021-08-24 08:57:21 +02:00
" ctrl+P: set paste
nmap <C-p> :set paste!<CR>
2021-08-24 08:59:22 +02:00
" ctrl+t fuer neuen tab
nmap <C-t> :tabnew<CR>
2021-08-15 12:42:20 +02:00
" leader-key
2021-06-01 17:44:59 +02:00
:let mapleader = ","
" lightline/statusline
2021-08-20 13:38:58 +02:00
" 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'
\ },
\ }
2021-06-01 17:44:59 +02:00
" buffergator
2021-05-28 08:51:12 +02:00
" https://joshldavis.com/2014/04/05/vim-tab-madness-buffers-vs-tabs/
" This allows buffers to be hidden if you've modified a buffer.
" " This is almost a must if you wish to use buffers in this way.
2021-08-12 12:58:32 +02:00
" https://medium.com/usevim/vim-101-set-hidden-f78800142855
2021-05-28 08:51:12 +02:00
set hidden
2021-08-12 12:58:32 +02:00
" öffne buffergator drawer horizontal unten
" https://github.com/jeetsukumaran/vim-buffergator/blob/master/doc/buffergator.txt
let g:buffergator_viewport_split_policy = 'B'
" gibt an wie hoch der drawer sein soll
let g:buffergator_hsplit_size = '10'
2021-06-01 17:46:00 +02:00
" Move to the next buffer
2021-05-28 08:51:12 +02:00
nmap <C-l> :bnext<CR>
" Move to the previous buffer
2021-05-28 09:19:23 +02:00
nmap <C-h> :bprevious<CR>
2021-06-01 17:44:59 +02:00
2021-08-30 17:49:53 +02:00
2021-06-01 17:44:59 +02:00
2021-05-27 17:54:53 +02:00
" ripgrep und ctrlp
" sudo apt install ripgrep(rg)
if executable('rg')
let g:ctrlp_user_command = 'rg %s --files --hidden --color=never --glob ""'
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
" vimagit
" https://github.com/jreybert/vimagit#mappings
nmap <Leader>m :Magit<cr>
2021-07-21 08:40:23 +02:00
" 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,*~
2021-08-20 21:22:39 +02:00
" zeige "matching" klammer usw.
set showmatch