diff options
| -rw-r--r-- | vimrc-full | 163 |
1 files changed, 51 insertions, 112 deletions
| @@ -1,24 +1,48 @@ | |||
| 1 | " vim: iskeyword+=\:,\!,\<,\>,\-,\& | 1 | " vim: noai:ts=2:sw=2:sts=2 iskeyword+=\:,\!,\<,\>,\-,\& |
| 2 | |||
| 2 | set textwidth=120 | " better done with modeline | 3 | set textwidth=120 | " better done with modeline |
| 3 | set ts=4 sts=4 sw=4 expandtab | " better done with a modeline | 4 | set ts=4 sts=4 sw=4 expandtab | " better done with a modeline |
| 5 | set redrawtime=1000 | " Timeout in milliseconds for redrawing the display / CTRL+L to retry | ||
| 4 | 6 | ||
| 5 | " scripts from the default vim installation, which do not get loaded by default, but are useful. | 7 | " scripts from the default vim installation, which do not get loaded by default, but are useful. |
| 6 | source $VIMRUNTIME/macros/editexisting.vim | 8 | silent ":runtime macros/editexisting.vim" |
| 7 | 9 | ||
| 8 | "======================================================================================================================= | 10 | if has("multi_byte") |
| 9 | " SETTINGS: | 11 | scriptencoding utf-8 | " tell vim that we are using utf-8 here |
| 10 | "======================================================================================================================= | 12 | set encoding=utf-8 | " we need default utf-8 encoding to use cool chars as line break and so on (see below) |
| 13 | set termencoding=&encoding | " once we use special chars we assume everybody uses a terminal supporting those | ||
| 14 | |||
| 15 | set fillchars+=fold:\— | " | ||
| 16 | set fillchars+=vert:\│ | " cool vertical split char | ||
| 17 | set fillchars+=diff:\ | " a whitespace gets used here | ||
| 18 | |||
| 19 | set listchars= | " initialize empty listchars | ||
| 20 | set listchars+=extends:» | " symbols used when using :set list (which displays non-printable chars) | ||
| 21 | set listchars+=precedes:« | " symbols used when using :set list (which displays non-printable chars) | ||
| 22 | |||
| 23 | set listchars+=tab:⮁\ | " symbols used when using :set list (which displays non-printable chars) | ||
| 24 | set listchars+=trail:· | " symbols used when using :set list (which displays non-printable chars) | ||
| 25 | " set listchars+=eol:↲ | " symbols used when using :set list (which displays non-printable chars) | ||
| 26 | " set listchars+=space:· | " symbols used when using :set list (which displays non-printable chars) | ||
| 27 | set showbreak+=› | " symbol used in the beginning of a wrapped line | ||
| 28 | set list | ||
| 29 | " set fillchars+=stlnc:\― | " | ||
| 30 | end | ||
| 31 | |||
| 32 | " ======================================================================================================================= | ||
| 33 | " SETTINGS: | ||
| 34 | " ======================================================================================================================= | ||
| 11 | set noautochdir | " When on, Vim will change the current working directory | 35 | set noautochdir | " When on, Vim will change the current working directory |
| 12 | set breakindent | " Every wrapped line will continue visually indented | 36 | set breakindent | " Every wrapped line will continue visually indented |
| 13 | set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well) | 37 | set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well) |
| 14 | set cmdheight=2 | " sets the command line's height | 38 | set cmdheight=2 | " sets the command line's height |
| 15 | set complete+=d | " scan current and included files for defined name or macro | 39 | set complete+=d | " scan current and included files for defined name or macro |
| 16 | set complete+=i | " scan current and included files for completions | 40 | set complete+=i | " scan current and included files for completions |
| 41 | set colorcolumn= | " not used, because we have a :match directive for textwidth | ||
| 17 | set concealcursor=nc | " limits the display of concealed text to normal and command mode | 42 | set concealcursor=nc | " limits the display of concealed text to normal and command mode |
| 18 | set conceallevel=2 | " replace escaped chars by their utf-8 representation (useful for LaTeX) | 43 | set conceallevel=2 | " replace escaped chars by their utf-8 representation (useful for LaTeX) |
| 19 | set confirm | " asks 'do you want to save?' | 44 | set confirm | " asks 'do you want to save?' |
| 20 | set cpoptions+=P | " makes :w filename set the current buffer to filename | 45 | set cpoptions+=P | " makes :w filename set the current buffer to filename |
| 21 | set guicursor=a:block-blinkon100 | ||
| 22 | set hidden | " allows switiching buffers even if the current buffer contains changes (displays +) | 46 | set hidden | " allows switiching buffers even if the current buffer contains changes (displays +) |
| 23 | set hlsearch | " highlights all search matches (not as performant!) | 47 | set hlsearch | " highlights all search matches (not as performant!) |
| 24 | set ignorecase smartcase | " search with ignorecase by default, but use case sensitive search when one captical char is contained | 48 | set ignorecase smartcase | " search with ignorecase by default, but use case sensitive search when one captical char is contained |
| @@ -45,7 +69,6 @@ set nowrap | " but do not (by default) wrap long lines around | |||
| 45 | set number | " turn line numbers on/off (performance decreases when they are shown) | 69 | set number | " turn line numbers on/off (performance decreases when they are shown) |
| 46 | set pumheight=8 | " Determines the maximum number of items to show in the popup menu for | 70 | set pumheight=8 | " Determines the maximum number of items to show in the popup menu for |
| 47 | set path+=** | " allow recursive searches for files | 71 | set path+=** | " allow recursive searches for files |
| 48 | set redrawtime=100 | " The time in milliseconds for redrawing the display. | ||
| 49 | " set restorescreen | " restores the console after exiting vim | 72 | " set restorescreen | " restores the console after exiting vim |
| 50 | " set shada+=n~/.vim/shada | " shada file to use | 73 | " set shada+=n~/.vim/shada | " shada file to use |
| 51 | set scrolljump=5 | " how many lines get scrolled into view when cursor reaches the screens edge | 74 | set scrolljump=5 | " how many lines get scrolled into view when cursor reaches the screens edge |
| @@ -59,9 +82,6 @@ set showtabline=2 | " 0: never, 1: only if there are at least two ta | |||
| 59 | set winwidth=30 | " keep NERDTreeWindow at least this size | 82 | set winwidth=30 | " keep NERDTreeWindow at least this size |
| 60 | set winminwidth=0 | " (and all other windows, so TODO: watch out) | 83 | set winminwidth=0 | " (and all other windows, so TODO: watch out) |
| 61 | set tags+=../tags | 84 | set tags+=../tags |
| 62 | " set textwidth=100 | " line length (80 used to be default, but...) | ||
| 63 | " set colorcolumn= | " not used, because we have a :match directive for textwidth | ||
| 64 | set undofile | " preserve undo history when closing and reopening buffers (see :help undo-persistenece) | ||
| 65 | set updatetime=80 | " updates the screen more often | 85 | set updatetime=80 | " updates the screen more often |
| 66 | set viminfo+=% | " restore buffer list | 86 | set viminfo+=% | " restore buffer list |
| 67 | set virtualedit=all | " virtual edit should be default behaviour, because I don't see any reason against | 87 | set virtualedit=all | " virtual edit should be default behaviour, because I don't see any reason against |
| @@ -75,6 +95,16 @@ set equalalways | " do not evenly size windows when opening new or | |||
| 75 | set nocursorline | " turn visual cursor line off (improves performance) | 95 | set nocursorline | " turn visual cursor line off (improves performance) |
| 76 | "======================================================================================================================= | 96 | "======================================================================================================================= |
| 77 | 97 | ||
| 98 | if has('persistent_undo') | ||
| 99 | set undofile | " preserve undo history when closing and reopening buffers (see :help undo-persistenece) | ||
| 100 | |||
| 101 | if isdirectory('/dev/shm') | ||
| 102 | set undodir=/dev/shm/ | " save undo file in memory. That is volatile, but fast and we have GIT for longer lasting undos | ||
| 103 | elseif isdirectory('/tmp/') | ||
| 104 | set undodir=/tmp/ | ||
| 105 | endif | ||
| 106 | endif | ||
| 107 | |||
| 78 | " START: LOADING PLUGINS | 108 | " START: LOADING PLUGINS |
| 79 | " ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ | 109 | " ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ |
| 80 | call plug#begin() | 110 | call plug#begin() |
| @@ -105,12 +135,6 @@ Plug 'chriskempson/base16-vim' | " not just one high quality color scheme | |||
| 105 | Plug 'mtth/scratch.vim' | 135 | Plug 'mtth/scratch.vim' |
| 106 | nnoremap <F2> :ScratchPreview<CR> | 136 | nnoremap <F2> :ScratchPreview<CR> |
| 107 | 137 | ||
| 108 | " VIM_ROOTER: | " Unobtrusive scratch window | ||
| 109 | " autocmd BufEnter * lcd %:p:h | " Plugin vim-rooter get used instead (which is much more sane as well) | ||
| 110 | Plug 'airblade/vim-rooter' | " makes :lcd changes to projects (git-)root (code-completion, gf, grep, find) | ||
| 111 | let g:rooter_targets="/,*.c,*.h" | " only use rooter for C, not LaTeX or anything else | ||
| 112 | " Vim rooter can be replaced by :Gcd provided by fugitive :) | ||
| 113 | |||
| 114 | " BUFEXPLORER: | " a buffer to list all buffers has the advantage, that default /-searches work in there | 138 | " BUFEXPLORER: | " a buffer to list all buffers has the advantage, that default /-searches work in there |
| 115 | Plug 'jlanzarotta/bufexplorer' | 139 | Plug 'jlanzarotta/bufexplorer' |
| 116 | nnoremap <F12> :ToggleBufExplorer<CR> | 140 | nnoremap <F12> :ToggleBufExplorer<CR> |
| @@ -196,24 +220,6 @@ let g:lightline_buffer_minflen = 16 | |||
| 196 | let g:lightline_buffer_minfextlen = 3 | 220 | let g:lightline_buffer_minfextlen = 3 |
| 197 | let g:lightline_buffer_reservelen = 20 | 221 | let g:lightline_buffer_reservelen = 20 |
| 198 | 222 | ||
| 199 | " function! MyFiletype() | ||
| 200 | " if(exists('b:filetype')) | ||
| 201 | " return b:filetype | ||
| 202 | " else | ||
| 203 | " return &filetype | ||
| 204 | " endfunction | ||
| 205 | " autocmd BufEnter * let b:filetype = winwidth(0) > 70 ? (strlen(&filetype) ? WebDevIconsGetFileTypeSymbol() . ':' . &filetype : 'no ft') : '' | ||
| 206 | " | ||
| 207 | " function! MyFileformat() | ||
| 208 | " return exists('b:fileformat') ? b:fileformat : &fileformat | ||
| 209 | " endfunction | ||
| 210 | " autocmd BufEnter * let b:fileformat = winwidth(0) > 70 ? WebDevIconsGetFileFormatSymbol() . ':' . &fileformat : '' | ||
| 211 | " | ||
| 212 | " function! MyBranchname() | ||
| 213 | " return exists('b:branchname') ? b:branchname : '' | ||
| 214 | " endfunction | ||
| 215 | " autocmd BufEnter * let b:branchname = winwidth(0) > 70 ? fugitive#statusline() : '' | ||
| 216 | |||
| 217 | let g:lightline = { | 223 | let g:lightline = { |
| 218 | \ 'colorscheme': 'Tomorrow_Night_Bright', | 224 | \ 'colorscheme': 'Tomorrow_Night_Bright', |
| 219 | \ 'separator': { 'left': "\ue0b0", 'right': "\ue0b2" }, | 225 | \ 'separator': { 'left': "\ue0b0", 'right': "\ue0b2" }, |
| @@ -247,52 +253,6 @@ let g:lightline = { | |||
| 247 | \ }, | 253 | \ }, |
| 248 | \ } | 254 | \ } |
| 249 | 255 | ||
| 250 | " lightline#palette() | ||
| 251 | |||
| 252 | " Plug 'vim-airline/vim-airline' | " beautification of the mode line | ||
| 253 | " let g:airline_section_c = "%F" | " was: %F | ||
| 254 | " let g:airline_detect_modified = 1 | | ||
| 255 | " let g:airline_detect_paste = 0 | | ||
| 256 | " let g:airline_exclude_preview = 0 | | ||
| 257 | " let g:airline_inactive_collapse = 1 | | ||
| 258 | " let g:airline_powerline_fonts = 1 | | ||
| 259 | " let g:airline_skip_empty_sections = 1 | | ||
| 260 | " let g:airline_extensions = [] | | ||
| 261 | " | ||
| 262 | " let g:airline#extensions#tabline#enabled = 1 | | ||
| 263 | " let g:airline#extensions#tabline#left_alt_sep = '' | | ||
| 264 | " let g:airline#extensions#tabline#left_sep = '' | | ||
| 265 | " let g:airline#extensions#tabline#right_alt_sep = '' | | ||
| 266 | " let g:airline#extensions#tabline#right_sep = '' | | ||
| 267 | " let g:airline#extensions#tabline#fnamemod = ':t' | " let airline just show the filename without its path | ||
| 268 | " let g:airline#extensions#tabline#disable_refresh = 1 | " refresh airline on bufadd ? | ||
| 269 | " let g:airline#extensions#tabline#enabled = 1 | | ||
| 270 | " let g:airline#extensions#tabline#show_buffers = 1 | | ||
| 271 | " let g:airline#extensions#tabline#show_tabs = 0 | | ||
| 272 | " let g:airline#extensions#tabline#ignore_bufadd_pat = '\c\vgundo|undotree|vimfiler|tagbar|nerd_tree|preview|^$' | ||
| 273 | " | ||
| 274 | " let g:airline_extensions#branch#enabled = 1 | | ||
| 275 | " let g:airline_extensions#whitespace#enabled = 0 | " airlines whitespace check is slow :/ | ||
| 276 | " let b:airline_whitespace_checks = ['indent', 'trailing', 'long', 'mixed-indent-file'] | ||
| 277 | " | ||
| 278 | " if has('python') | ||
| 279 | " let g:airline_extensions#syntastic#enabled = 1 | | ||
| 280 | " let g:airline_extensions#ycm#enabled = 1 | | ||
| 281 | " endif | ||
| 282 | " | ||
| 283 | " let g:airline#extensions#tagbar#flags = 'f' | " even though the airline extension is off this controls :h tagbar-extend | ||
| 284 | " let g:airline#extensions#tagbar#enabled = 0 | | ||
| 285 | " | ||
| 286 | " " AIRLINE_Theme: | ||
| 287 | " Plug 'vim-airline/vim-airline-themes' | " airline themes to match any light and dark terminal using :AirlineTheme | ||
| 288 | " let base16colorspace=256 | | ||
| 289 | " let g:airline_theme='base16' | " specifies which colorscheme should airline uses | ||
| 290 | " let g:airline#themes#base16#constant = 0 | | ||
| 291 | " " let g:solarized_base16 = 1 | ||
| 292 | " " let g:airline_base16_improved_contrast = 1 | ||
| 293 | " " let g:airline_theme='badcat' | " specifies which colorscheme should airline uses | ||
| 294 | " " let g:airline_theme='papercolor' | " specifies which colorscheme should ionirline uses | ||
| 295 | |||
| 296 | " Autocompleter: ===================================== | 256 | " Autocompleter: ===================================== |
| 297 | if has("python") | 257 | if has("python") |
| 298 | " YouCompleteMe: ===================================================================================================== | 258 | " YouCompleteMe: ===================================================================================================== |
| @@ -427,13 +387,14 @@ endif | |||
| 427 | 387 | ||
| 428 | 388 | ||
| 429 | 389 | ||
| 430 | |||
| 431 | "======================================================================================================================= | 390 | "======================================================================================================================= |
| 432 | " GENERAL: | 391 | " GENERAL: |
| 433 | "======================================================================================================================= | 392 | "======================================================================================================================= |
| 434 | 393 | ||
| 435 | if filereadable("/bin/bash") | 394 | if filereadable("/bin/bash") |
| 436 | set shell=/bin/bash | " many scripts rely on bash, but its path varies why it is commented out here | 395 | set shell=/bin/bash | " many scripts rely on bash, but its path varies why it is commented out here |
| 396 | elseif filereadable("/usr/local/bin/bash") | ||
| 397 | set shell=/usr/local/bin/bash | ||
| 437 | endif | 398 | endif |
| 438 | 399 | ||
| 439 | 400 | ||
| @@ -449,7 +410,6 @@ set thesaurus+=/home/max/.vim/thesaurus/php.txt | |||
| 449 | set dictionary=/usr/share/dict/cracklib-small | 410 | set dictionary=/usr/share/dict/cracklib-small |
| 450 | set complete+=k " make default completer <C-N> respect the dictionary | 411 | set complete+=k " make default completer <C-N> respect the dictionary |
| 451 | 412 | ||
| 452 | " set fillchars+=stlnc:\― | " | ||
| 453 | 413 | ||
| 454 | 414 | ||
| 455 | if has('autocmd') | 415 | if has('autocmd') |
| @@ -459,27 +419,6 @@ if has('autocmd') | |||
| 459 | endif | 419 | endif |
| 460 | 420 | ||
| 461 | "======================================================================================================================= | 421 | "======================================================================================================================= |
| 462 | if has("multi_byte") | ||
| 463 | scriptencoding utf-8 | " tell vim that we are using utf-8 here | ||
| 464 | set encoding=utf-8 | " we need default utf-8 encoding to use cool chars as line break and so on (see below) | ||
| 465 | set termencoding=&encoding | " once we use special chars we assume everybody uses a terminal supporting those | ||
| 466 | |||
| 467 | set fillchars+=fold:\— | " | ||
| 468 | set fillchars+=vert:\│ | " cool vertical split char | ||
| 469 | set fillchars+=diff:\ | " a whitespace gets used here | ||
| 470 | |||
| 471 | set listchars= | " initialize empty listchars | ||
| 472 | set listchars+=extends:» | " symbols used when using :set list (which displays non-printable chars) | ||
| 473 | set listchars+=precedes:« | " symbols used when using :set list (which displays non-printable chars) | ||
| 474 | |||
| 475 | set listchars+=tab:⮁\ | " symbols used when using :set list (which displays non-printable chars) | ||
| 476 | set listchars+=trail:· | " symbols used when using :set list (which displays non-printable chars) | ||
| 477 | " set listchars+=eol:↲ | " symbols used when using :set list (which displays non-printable chars) | ||
| 478 | " set listchars+=space:· | " symbols used when using :set list (which displays non-printable chars) | ||
| 479 | set showbreak+=› | " symbol used in the beginning of a wrapped line | ||
| 480 | set list | ||
| 481 | end | ||
| 482 | |||
| 483 | if has('cscope') " compiled with cscope support? | 422 | if has('cscope') " compiled with cscope support? |
| 484 | " http://vim.wikia.com/wiki/Cscope | 423 | " http://vim.wikia.com/wiki/Cscope |
| 485 | set cscopetag | " CTRL-] uses cscope first, then ctags | 424 | set cscopetag | " CTRL-] uses cscope first, then ctags |
| @@ -500,6 +439,7 @@ endif | |||
| 500 | 439 | ||
| 501 | " GUI_VERSION: | 440 | " GUI_VERSION: |
| 502 | if has("gui_running") | 441 | if has("gui_running") |
| 442 | set guicursor=a:block-blinkon100 | ||
| 503 | set browsedir=buffer | 443 | set browsedir=buffer |
| 504 | set toolbar+=text | 444 | set toolbar+=text |
| 505 | set guiheadroom=0 | 445 | set guiheadroom=0 |
| @@ -674,14 +614,13 @@ if has("autocmd") | |||
| 674 | let @l = ":let g:signify_vcs_cmds={'git': 'git diff --no-color --no-ext-diff -U0 HEAD^ -- %f'}|:SignifyRefresh" | 614 | let @l = ":let g:signify_vcs_cmds={'git': 'git diff --no-color --no-ext-diff -U0 HEAD^ -- %f'}|:SignifyRefresh" |
| 675 | 615 | ||
| 676 | 616 | ||
| 677 | source $VIMRUNTIME/menu.vim | ||
| 678 | set wildmenu | ||
| 679 | set cpo-=< | ||
| 680 | set wcm=<C-Z> | ||
| 681 | map <F4> :emenu <C-Z> | ||
| 682 | 617 | ||
| 683 | if has('menu') | 618 | if has('menu') |
| 684 | 619 | source $VIMRUNTIME/menu.vim | |
| 620 | set wildmenu | ||
| 621 | set cpo-=< | ||
| 622 | set wcm=<C-Z> | ||
| 623 | map <F4> :emenu <C-Z> | ||
| 685 | 624 | ||
| 686 | menu &Chdir.Git\ root | 625 | menu &Chdir.Git\ root |
| 687 | \ :Gcd<CR>:pwd<CR> | 626 | \ :Gcd<CR>:pwd<CR> |
| @@ -818,9 +757,9 @@ endif | |||
| 818 | 757 | ||
| 819 | 758 | ||
| 820 | " avoids openin an empty buffer when restoring bufferlist from viminfo... | 759 | " avoids openin an empty buffer when restoring bufferlist from viminfo... |
| 821 | if argc() == 0 | 760 | " if argc() == 0 |
| 822 | autocmd VimEnter * nested :silent bun | 761 | " autocmd VimEnter * nested :silent bun |
| 823 | endif | 762 | " endif |
| 824 | " au BufNewFile,BufRead,BufEnter *.cpp,*.hpp set omnifunc=omni#cpp#complete#Main | 763 | " au BufNewFile,BufRead,BufEnter *.cpp,*.hpp set omnifunc=omni#cpp#complete#Main |
| 825 | " Enable omni completion. | 764 | " Enable omni completion. |
| 826 | " autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS | 765 | " autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS |
