dotfiles/.vimrc

194 lines
5.8 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-12-21 22:38:56 +01:00
" highlight fuer movement mit tTfFwW
Plugin 'unblevable/quick-scope'
2021-05-31 20:44:56 +02:00
" fuzzy finder
2021-08-12 13:30:31 +02:00
Plugin 'ctrlpvim/ctrlp.vim'
2021-12-21 21:28:47 +01:00
" sneak motion
Plugin 'justinmk/vim-sneak'
2021-11-24 13:28:37 +01:00
" Shellcheck Integration
Plugin 'itspriddle/vim-shellcheck'
2021-05-31 20:44:56 +02:00
" git integration G:
2021-08-12 13:30:31 +02:00
Plugin 'tpope/vim-fugitive'
" statusline
Plugin 'itchyny/lightline.vim'
2021-12-21 21:17:13 +01:00
" ausrichten von text
Plugin 'junegunn/vim-easy-align'
2021-11-21 11:06:52 +01:00
" buffer in tabline
Plugin 'ap/vim-buftabline'
2021-11-21 11:22:17 +01:00
" start screen
Plugin 'mhinz/vim-startify'
2021-11-22 07:19:31 +01:00
" bracketed paste/ keine set-paste mehr
Plugin 'ConradIrwin/vim-bracketed-paste'
2021-11-17 20:46:49 +01:00
" multi cursor; setze cursor mit \\\
Plugin 'mg979/vim-visual-multi'
2021-11-19 07:49:45 +01:00
" Markdown-Preview in Browser
" :source %
" :PluginInstall
" :call mkdp#util#install()
" Befehle nach Installation notwendig
2022-01-09 14:55:51 +01:00
Plugin 'iamcco/markdown-preview.nvim'
2021-05-27 17:54:53 +02:00
call vundle#end()
2021-06-01 17:44:59 +02:00
2021-11-30 08:39:30 +01:00
let mapleader = ","
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
" Show line numbers.
set number
2021-11-29 18:18:28 +01:00
" setze cursorline
set cursorline
highlight CursorLine cterm=NONE ctermbg=green ctermfg=white guibg=darkred guifg=white
2021-08-31 13:08:37 +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,*~
" ### 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
" https://vim.fandom.com/wiki/Automatic_word_wrapping
set wrap linebreak
" Enable syntax highlighting
syntax on
2021-12-05 12:17:24 +01:00
" aktiviere maus nur im normalmode
set mouse=n
2021-08-31 13:08:37 +02:00
" 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-10-26 12:12:30 +02:00
" ### Plugins
2021-08-31 13:08:37 +02:00
" ### ripgrep und ctrlp
2021-05-27 17:54:53 +02:00
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
" 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
let g:ctrlp_map = ''
let g:ctrlp_extensions = ['line', 'undo']
2021-11-19 07:50:05 +01:00
2021-11-24 13:59:01 +01:00
" ### shellcheck
" farbe für zeilenmarkierung im quickfix-windows
hi QuickFixLine ctermbg=black guibg=black
2021-11-24 14:51:25 +01:00
2021-11-19 07:50:05 +01:00
" ### 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'
\ },
\ }
" ### vim startify
2021-11-21 11:22:17 +01:00
" returns all modified files of the current git repo
" `2>/dev/null` makes the command fail quietly, so that when we are not
" in a git repo, the list will be empty
function! s:gitModified()
let files = systemlist('git ls-files -m 2>/dev/null')
return map(files, "{'line': v:val, 'path': v:val}")
endfunction
" same as above, but show untracked files, honouring .gitignore
function! s:gitUntracked()
let files = systemlist('git ls-files -o --exclude-standard 2>/dev/null')
return map(files, "{'line': v:val, 'path': v:val}")
endfunction
let g:startify_lists = [
\ { 'type': 'files', 'header': [' MRU'] },
\ { 'type': 'dir', 'header': [' MRU '. getcwd()] },
\ { 'type': 'sessions', 'header': [' Sessions'] },
\ { 'type': 'bookmarks', 'header': [' Bookmarks'] },
\ { 'type': function('s:gitModified'), 'header': [' git modified']},
\ { 'type': function('s:gitUntracked'), 'header': [' git untracked']},
\ { 'type': 'commands', 'header': [' Commands'] },
\ ]
2021-12-21 21:28:47 +01:00
" ### vim-sneak
let g:sneak#s_next = 1
2021-12-21 22:38:56 +01:00
" ### quick-scope
" Trigger a highlight in the appropriate direction only when pressing these keys:
let g:qs_highlight_on_keys = ['f', 'F', 't', 'T']
2021-11-19 07:50:05 +01:00
2021-08-31 13:08:37 +02:00
" ### Keybindings
" deaktiviere Ex-Mode keybinding
2021-11-30 08:39:30 +01:00
nnoremap Q <Nop>
2021-11-22 07:24:41 +01:00
" Ctrl+w zum speichern
nmap <C-w> :q<CR>
2021-08-31 13:08:37 +02:00
" Ctrl+S zum speichern
2021-11-30 08:39:30 +01:00
nnoremap <C-s> :w<CR>
2021-11-21 11:06:52 +01:00
" Navigate tabs
nnoremap <C-j> :bnext<CR>
nnoremap <C-k> :bprev<CR>
2021-11-22 07:20:08 +01:00
" Saner CTRL-L
" https://github.com/mhinz/vim-galore#saner-ctrl-l
2021-11-30 08:39:30 +01:00
nnoremap <Leader>dh :nohlsearch<cr>:diffupdate<cr>:syntax sync fromstart<cr><c-l>
2021-11-29 18:18:28 +01:00
" toggle linenumbers
2021-11-30 08:39:30 +01:00
nnoremap <Leader>z :set nonu!<CR>
2021-11-29 18:18:28 +01:00
" toggle cursorline
2021-11-30 08:39:30 +01:00
nnoremap <Leader>h :set nocursorline!<CR>
" strg+f sucht fuzzy nach dateien
nnoremap <C-f> :CtrlP<CR>
2022-01-09 14:55:51 +01:00
" strg+l sucht fuzzy in Zeilen des aktuellen Buffers
2021-11-30 08:39:30 +01:00
nnoremap <C-l> :CtrlPLine<CR>
" mit , + n/p wechsele den Eintrag im Quickfix-Windows vor/zurück
2022-01-09 14:55:51 +01:00
" mit , c Öffne ShellCheck im Quickfix Windows
2021-11-30 08:39:30 +01:00
nnoremap cn :cn<CR>
nnoremap cp :cp<CR>
nnoremap <Leader>sc :ShellCheck!<CR>
" ### markdown-preview
nnoremap <Leader>m :MarkdownPreviewToggle<CR>
2021-12-21 21:17:13 +01:00
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
2022-01-09 14:55:42 +01:00
" lasse Y wie C oder D funktionieren
nmap Y y$
2021-11-30 08:50:10 +01:00
2021-12-21 21:28:47 +01:00
2021-11-30 08:50:10 +01:00
" ### Abbreviations
iabbrev ncicht nicht
iabbrev nciht nicht