diff options
Diffstat (limited to 'vimrc')
-rw-r--r-- | vimrc | 135 |
1 files changed, 110 insertions, 25 deletions
@@ -1,7 +1,14 @@ | |||
1 | " vim: textwidth=160 tabstop=2 shiftwidth=2 | ||
2 | " | ||
3 | if has('nvim') | ||
4 | runtime! python_setup.vim | ||
5 | endif | ||
6 | |||
1 | call plug#begin() | 7 | call plug#begin() |
2 | 8 | ||
9 | |||
3 | " Brilliant_Plugins_by_tpope: ========================. | 10 | " Brilliant_Plugins_by_tpope: ========================. |
4 | Plug 'tpope/vim-sensible' | " a sane and modern default configuration | 11 | " Plug 'tpope/vim-sensible' | " a sane and modern default configuration # not required with nvim |
5 | Plug 'tpope/vim-surround' | " plugin makes cs"' inside a line replace " with ' | 12 | Plug 'tpope/vim-surround' | " plugin makes cs"' inside a line replace " with ' |
6 | Plug 'tpope/vim-fugitive' | " the most complete GIT integration plugin | 13 | Plug 'tpope/vim-fugitive' | " the most complete GIT integration plugin |
7 | Plug 'godlygeek/tabular' | " align code on a sign, like :Tab/= | 14 | Plug 'godlygeek/tabular' | " align code on a sign, like :Tab/= |
@@ -9,17 +16,30 @@ Plug 'mhinz/vim-signify' | " show changes in the cl | |||
9 | 16 | ||
10 | 17 | ||
11 | " Colorschemes: ======================================. | 18 | " Colorschemes: ======================================. |
19 | Plug 'ryanoasis/vim-devicons' | " eye candy icons | ||
12 | Plug 'chriskempson/base16-vim' | " | 20 | Plug 'chriskempson/base16-vim' | " |
13 | map <leader>q :bp<bar>sp<bar>bn<bar>bd<CR>. | 21 | map <leader>q :bp<bar>sp<bar>bn<bar>bd<CR>. |
14 | 22 | ||
15 | 23 | ||
24 | " NETRW: =============================================. | ||
25 | let g:netrw_list_hide = '^\..*' | " Explore mode: hide files starting with dot | ||
26 | let g:netrw_hide = 1 | " show not-hidden files only | ||
27 | let g:netrw_liststyle = 3 | " 3=tree | ||
28 | let g:netrw_banner = 0 | " display help messages? | ||
29 | let g:netrw_winsize = 20 | " window size in percent | ||
30 | let g:netrw_fastbrowse = 2 | " manually refresh direcory list (avoids display errors) | ||
31 | let g:netrw_keepdir = 0 | ||
32 | let g:netrw_browse_split = 4 | " 4=open in previous window | ||
33 | let g:netrw_preview = 0 | " | ||
34 | let g:netrw_alto = 0 | " open files on the right | ||
35 | let g:netrw_altv = 1 | " open files on the right | ||
36 | |||
16 | " NERDTree: ==========================================. | 37 | " NERDTree: ==========================================. |
17 | Plug 'scrooloose/nerdtree' | " replace NetRW, which is kind of buggy | 38 | Plug 'scrooloose/nerdtree' | " replace NetRW, which is kind of buggy |
18 | let NERDTreeCascadeSingleChildDir = 0 | " I don't get how one can use <m> to create files in that included directory | 39 | let NERDTreeCascadeSingleChildDir = 0 | " I don't get how one can use <m> to create files in that included directory |
19 | set winwidth=30 " keep NERDTreeWindow at least this size | 40 | set winwidth=30 " keep NERDTreeWindow at least this size |
20 | set winminwidth=30 " (and all other windows, so TODO: watch out) | 41 | set winminwidth=30 " (and all other windows, so TODO: watch out) |
21 | 42 | ||
22 | autocmd BufEnter * lcd %:p:h | ||
23 | " depending on if NERDTree has the focus: | 43 | " depending on if NERDTree has the focus: |
24 | nnoremap <expr> | 44 | nnoremap <expr> |
25 | \ <leader><leader> | 45 | \ <leader><leader> |
@@ -33,6 +53,9 @@ nnoremap <expr> | |||
33 | " close NERDTree if it is the last remaining window (taken from the official documentation) | 53 | " close NERDTree if it is the last remaining window (taken from the official documentation) |
34 | " autocmd bufenter * | 54 | " autocmd bufenter * |
35 | " \ if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif | 55 | " \ if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif |
56 | " | ||
57 | " exec current line as a command, insert output of command (from: https://youtu.be/MquaityA1SM?t=35m45s) | ||
58 | nnoremap Q !!$SHELL<CR> | ||
36 | 59 | ||
37 | 60 | ||
38 | " AIRLINE: ===========================================. | 61 | " AIRLINE: ===========================================. |
@@ -86,20 +109,28 @@ let g:tagbar_foldlevel = 99 | |||
86 | nnoremap <leader>l :TagbarToggle<CR>| " bind TagBar to Hotkey Ctrl+L | 109 | nnoremap <leader>l :TagbarToggle<CR>| " bind TagBar to Hotkey Ctrl+L |
87 | 110 | ||
88 | 111 | ||
112 | |||
113 | |||
89 | " Autocompleter: =====================================. | 114 | " Autocompleter: =====================================. |
90 | Plug 'Valloric/MatchTagAlways' " highlights the closing tag/brace/... | 115 | Plug 'Valloric/MatchTagAlways' " highlights the closing tag/brace/... |
91 | Plug 'Valloric/YouCompleteMe' | 116 | Plug 'Valloric/YouCompleteMe' |
92 | let g:ycm_collect_identifiers_from_tags_files = 1 " Let YCM read tags from Ctags file | 117 | let g:ycm_collect_identifiers_from_tags_files = 1 " Let YCM read tags from Ctags file |
118 | let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword | ||
93 | let g:ycm_complete_in_comments = 1 " Completion in comments | 119 | let g:ycm_complete_in_comments = 1 " Completion in comments |
94 | let g:ycm_complete_in_strings = 1 " Completion in string | 120 | let g:ycm_complete_in_strings = 1 " Completion in string |
95 | let g:ycm_error_symbol = '✖' " insert this as an error symbol in the gutter bar | 121 | let g:ycm_error_symbol = '✖' " insert this as an error symbol in the gutter bar |
96 | let g:ycm_min_num_of_chars_for_completion = 1 | 122 | let g:ycm_min_num_of_chars_for_completion = 1 |
97 | let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword | ||
98 | let g:ycm_use_ultisnips_completer = 1 " Default 1, just ensure | 123 | let g:ycm_use_ultisnips_completer = 1 " Default 1, just ensure |
99 | let g:ycm_warning_symbol = '➔' " insert this as a warning symbol in the gutter bar | 124 | let g:ycm_warning_symbol = '➔' " insert this as a warning symbol in the gutter bar |
125 | let g:ycm_confirm_extra_conf = 0 " security is overrated | ||
126 | let g:ycm_key_list_select_completion = ['<Down>'] | ||
127 | let g:ycm_key_list_previous_completion = ['<Up>'] | ||
100 | " disable <tab>-key for YCM so that it can be used with ultisnips | 128 | " disable <tab>-key for YCM so that it can be used with ultisnips |
101 | " let g:ycm_key_list_select_completion=[] | 129 | " let g:ycm_key_list_select_completion=[] |
102 | " let g:ycm_key_list_previous_completion=[] | 130 | " let g:ycm_key_list_previous_completion=[] |
131 | Plug 'rdnetto/YCM-Generator' | ||
132 | |||
133 | " Plug 'ervandew/supertab' | ||
103 | 134 | ||
104 | 135 | ||
105 | Plug 'scrooloose/syntastic' | 136 | Plug 'scrooloose/syntastic' |
@@ -136,10 +167,25 @@ Plug 'SirVer/ultisnips' " replaces loremipsum (and | |||
136 | "let g:UltiSnipsJumpForwardTrigger = '<C-j>'| " \ | 167 | "let g:UltiSnipsJumpForwardTrigger = '<C-j>'| " \ |
137 | "let g:UltiSnipsJumpBackwardTrigger = '<C-k>'| " \ | 168 | "let g:UltiSnipsJumpBackwardTrigger = '<C-k>'| " \ |
138 | "let g:UltiSnipsListSnippets = '<C-`>'| " YouCompleteMe includes those, so this isn't necessary | 169 | "let g:UltiSnipsListSnippets = '<C-`>'| " YouCompleteMe includes those, so this isn't necessary |
139 | let g:UltiSnipsExpandTrigger = '<leader><tab>'| " Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe. | 170 | " let g:UltiSnipsExpandTrigger = '<leader><tab>'| " Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe. |
140 | let g:UltiSnipsJumpForwardTrigger = '<PageDown>'| " \ | 171 | " let g:UltiSnipsJumpForwardTrigger = '<PageDown>'| " \ |
141 | let g:UltiSnipsJumpBackwardTrigger = '<PageUp>'| " \ | 172 | " let g:UltiSnipsJumpBackwardTrigger = '<PageUp>'| " \ |
142 | let g:UltiSnipsListSnippets = '<leader><leader>'| " YouCompleteMe includes those, so this isn't necessary | 173 | " let g:UltiSnipsListSnippets = '<leader><leader>'| " YouCompleteMe includes those, so this isn't necessary |
174 | |||
175 | " UltiSnips triggering | ||
176 | " let g:UltiSnipsExpandTrigger = "<nop>" | ||
177 | " let g:ulti_expand_or_jump_res = 0 | ||
178 | " function ExpandSnippetOrCarriageReturn() | ||
179 | " let snippet = UltiSnips#ExpandSnippetOrJump() | ||
180 | " if g:ulti_expand_or_jump_res > 0 | ||
181 | " return snippet | ||
182 | " else | ||
183 | " return "\<CR>" | ||
184 | " endif | ||
185 | " endfunction | ||
186 | " inoremap <expr> <CR> pumvisible() ? "\<C-R>=ExpandSnippetOrCarriageReturn()\<CR>" : "\<CR>" | ||
187 | " set completeopt-=preview | ||
188 | |||
143 | " let g:UltiSnipsEditSplit = 'vertical' | 189 | " let g:UltiSnipsEditSplit = 'vertical' |
144 | 190 | ||
145 | 191 | ||
@@ -172,9 +218,25 @@ inoremap | |||
172 | 218 | ||
173 | noremap <silent> <F5> :make<CR> | 219 | noremap <silent> <F5> :make<CR> |
174 | 220 | ||
221 | " default copy&paste insert key binding (just in insert mode, so it doesn't conflict | ||
222 | " with visual block mode). | ||
223 | inoremap <C-V> <C-R>+ | ||
224 | inoremap <C-S> <C-O>:w<CR> | ||
225 | |||
226 | |||
227 | |||
228 | |||
229 | " spell checkers? | ||
230 | set spell spelllang=en,de | " enable spell checker | ||
231 | set dictionary=/usr/share/dict/cracklib-small | ||
232 | set complete+=k " make default completer <C-N> respect the dictionary | ||
175 | 233 | ||
234 | let g:spellfile_URL = 'http://ftp.vim.org/vim/runtime/spell' | ||
176 | 235 | ||
177 | " settings ============================================. | 236 | " settings ============================================. |
237 | " | ||
238 | " autocmd BufEnter * lcd %:p:h | ||
239 | set autochdir | " When on, Vim will change the current working directory | ||
178 | set shell=/bin/bash | " many scripts rely on bash, but its path varies why it is commented out here | 240 | set shell=/bin/bash | " many scripts rely on bash, but its path varies why it is commented out here |
179 | " set selectmode=mouse,key,cmd | " enters vim's select mode when pressing shift-left or shift-END | 241 | " set selectmode=mouse,key,cmd | " enters vim's select mode when pressing shift-left or shift-END |
180 | " set keymodel=startsel,stopsel | " makes shift-left, shift-right available for selecting text | 242 | " set keymodel=startsel,stopsel | " makes shift-left, shift-right available for selecting text |
@@ -204,17 +266,20 @@ set notimeout ttimeout | " improves performance but is known to cause pro | |||
204 | set nowrap | " but do not (by default) wrap long lines around | 266 | set nowrap | " but do not (by default) wrap long lines around |
205 | set number | " turn line numbers on/off (performance decreases when they are shown) | 267 | set number | " turn line numbers on/off (performance decreases when they are shown) |
206 | set pumheight=8 | " Determines the maximum number of items to show in the popup menu for | 268 | set pumheight=8 | " Determines the maximum number of items to show in the popup menu for |
269 | set path+=** | " allow recursive searches for files | ||
207 | set redrawtime=400 | " The time in milliseconds for redrawing the display. | 270 | set redrawtime=400 | " The time in milliseconds for redrawing the display. |
208 | " set restorescreen | " restores the console after exiting vim | 271 | " set restorescreen | " restores the console after exiting vim |
272 | " set shada+=n~/.vim/shada | " shada file to use | ||
209 | set scrolljump=5 | " how many lines get scrolled into view when cursor reaches the screens edge | 273 | set scrolljump=5 | " how many lines get scrolled into view when cursor reaches the screens edge |
210 | set spell spelllang=en,de | " enable spell checker | ||
211 | set splitbelow | " open new windows below the current one (i find that more intuitive) | 274 | set splitbelow | " open new windows below the current one (i find that more intuitive) |
275 | set shiftround | " indent/unindent snaps to multiple of shiftwidth | ||
276 | set showcmd | " essential: show keys of combined commands in the lower right corner | ||
212 | " set t_Co=256 | " required on some ssh sessions | 277 | " set t_Co=256 | " required on some ssh sessions |
213 | " set textwidth=100 | " line length (80 used to be default, but...) | 278 | " set textwidth=100 | " line length (80 used to be default, but...) |
214 | set thesaurus+=/home/max/.vim/thesaurus/php.txt | 279 | set thesaurus+=/home/max/.vim/thesaurus/php.txt |
215 | set ts=2 sts=2 sw=2 expandtab | " indentation which i like (abbr: tabstop, softtabstop, shiftwidth) | 280 | set ts=2 sts=2 sw=2 expandtab | " indentation which i like (abbr: tabstop, softtabstop, shiftwidth) |
216 | set ttimeoutlen=10 | " set esc key timeout in ms- | 281 | set ttimeoutlen=10 | " set esc key timeout in ms- |
217 | set ttyfast | " improves speed for terminal vim | 282 | " set ttyfast | " improves speed for terminal vim (incomp. with nvim) |
218 | set updatetime=1000 | " updates the screen more often | 283 | set updatetime=1000 | " updates the screen more often |
219 | " set ttyscroll=100 | " improves speed for terminal vim, incomp. with nvim | 284 | " set ttyscroll=100 | " improves speed for terminal vim, incomp. with nvim |
220 | set writedelay=0 | 285 | set writedelay=0 |
@@ -243,6 +308,8 @@ if has("gui_running") | |||
243 | " set guifont=Droid\ Sans\ Mono\ for\ Powerline\ 12 | 308 | " set guifont=Droid\ Sans\ Mono\ for\ Powerline\ 12 |
244 | set guifont=Dejavu\ Sans\ Mono\ for\ Powerline\ 12 | 309 | set guifont=Dejavu\ Sans\ Mono\ for\ Powerline\ 12 |
245 | set guioptions-=e | " do not display tabs | 310 | set guioptions-=e | " do not display tabs |
311 | set guioptions-=L | " do not show left scrollbar | ||
312 | set guioptions-=r | " do not show right scrollbar | ||
246 | set winaltkeys=menu | " behave like other windows: ALT-key can be used to open the menu (and cannot be :remaped) | 313 | set winaltkeys=menu | " behave like other windows: ALT-key can be used to open the menu (and cannot be :remaped) |
247 | endif | 314 | endif |
248 | 315 | ||
@@ -316,6 +383,21 @@ if has("autocmd") | |||
316 | autocmd VimLeave * silent !echo -ne "\033]112\007" | 383 | autocmd VimLeave * silent !echo -ne "\033]112\007" |
317 | augroup END | 384 | augroup END |
318 | 385 | ||
386 | augroup ChangeIcon | ||
387 | "if filereadable("/usr/bin/xseticon") | ||
388 | "if filereadable("~/.vim/nvim.png") | ||
389 | autocmd VimEnter * silent :execute "!xseticon -id $WINDOWID ~/.vim/nvim.png" | ||
390 | autocmd VimLeave * silent :execute "!xseticon -id $WINDOWID /usr/share/icons/gnome/32x32/apps/xfce-terminal.png" | ||
391 | "endif | ||
392 | "endif | ||
393 | augroup END | ||
394 | |||
395 | if has('nvim') | ||
396 | else | ||
397 | augroup vimonly | ||
398 | autocmd VimLeave * call system("echo -n $'" . escape(getreg(), "'") . "' | xsel -ib") | ||
399 | augroup END | ||
400 | endif | ||
319 | "set omnifunc=syntaxcomplete#Complete | 401 | "set omnifunc=syntaxcomplete#Complete |
320 | " au BufNewFile,BufRead,BufEnter *.cpp,*.hpp set omnifunc=omni#cpp#complete#Main | 402 | " au BufNewFile,BufRead,BufEnter *.cpp,*.hpp set omnifunc=omni#cpp#complete#Main |
321 | " Enable omni completion. | 403 | " Enable omni completion. |
@@ -334,15 +416,29 @@ if has("autocmd") | |||
334 | " endif | 416 | " endif |
335 | endif | 417 | endif |
336 | 418 | ||
337 | 419 | let &t_Co=256 | |
420 | set background=dark | ||
421 | " set termguicolors | ||
338 | let base16colorspace=256 | 422 | let base16colorspace=256 |
339 | if filereadable(expand("~/.vimrc_background")) | 423 | if filereadable(expand("~/.vimrc_background")) |
340 | source ~/.vimrc_background | 424 | source ~/.vimrc_background |
341 | set background=light | ||
342 | else | 425 | else |
343 | colorscheme base16-phd | 426 | colorscheme base16-phd |
344 | set background=dark | ||
345 | endif | 427 | endif |
428 | |||
429 | |||
430 | |||
431 | |||
432 | if !has('nvim') | ||
433 | set ttymouse=xterm2 | ||
434 | else | ||
435 | " shortcut \t opens a terminal in a horizontal split | ||
436 | nnoremap <leader>t :new +terminal<CR> | ||
437 | endif | ||
438 | |||
439 | |||
440 | |||
441 | |||
346 | " colorscheme base16-embers | 442 | " colorscheme base16-embers |
347 | " colorscheme base16-flat | 443 | " colorscheme base16-flat |
348 | " colorscheme base16-summerfruit-dark | 444 | " colorscheme base16-summerfruit-dark |
@@ -380,16 +476,5 @@ endif | |||
380 | " let g:miniBufExplShowBufNumbers = 0 | 476 | " let g:miniBufExplShowBufNumbers = 0 |
381 | " let g:miniBufExplSplitToEdge = 1 | 477 | " let g:miniBufExplSplitToEdge = 1 |
382 | " let g:miniBufExplVSplit = 20 " column width in chars | 478 | " let g:miniBufExplVSplit = 20 " column width in chars |
383 | " NETRW: =============================================. | 479 | |
384 | " Plug 'tpope/vim-vinegar' | " Improves :Explore | 480 | |
385 | " let g:netrw_list_hide = '^\..*' | " Explore mode: hide files starting with dot | ||
386 | " let g:netrw_hide = 1 | " show not-hidden files only | ||
387 | " let g:netrw_liststyle = 3 | " 3=tree | ||
388 | " let g:netrw_banner = 0 | " display help messages? | ||
389 | " let g:netrw_winsize = 20 | " window size in percent | ||
390 | " let g:netrw_fastbrowse = 2 | " manually refresh direcory list (avoids display errors) | ||
391 | " let g:netrw_keepdir = 0 | ||
392 | " let g:netrw_browse_split = 4 | " 4=open in previous window | ||
393 | " let g:netrw_preview = 0 | " | ||
394 | " let g:netrw_alto = 0 | " open files on the right | ||
395 | " let g:netrw_altv = 1 | " open files on the right | ||