aboutsummaryrefslogtreecommitdiff
path: root/vimrc-full
diff options
context:
space:
mode:
authorCharlie Root2017-08-17 00:00:42 +0200
committerCharlie Root2017-08-17 00:00:42 +0200
commit0c225499227c94b089b65fc0a9f5752e0d2b16f5 (patch)
tree6b048038d31b2dc3baec00b22f5e8617953c00a7 /vimrc-full
parentbf8e5591401426fadac2a416bc824e65af001dbf (diff)
downloadvim-karlmarks-0c225499227c94b089b65fc0a9f5752e0d2b16f5.tar.bz2
vim-karlmarks-0c225499227c94b089b65fc0a9f5752e0d2b16f5.zip
restructured vimrc for faster loading, added menus
Diffstat (limited to 'vimrc-full')
-rw-r--r--vimrc-full705
1 files changed, 373 insertions, 332 deletions
diff --git a/vimrc-full b/vimrc-full
index 5b12fd7..5e9f790 100644
--- a/vimrc-full
+++ b/vimrc-full
@@ -1,12 +1,18 @@
1" vim: noai:ts=2:sw=2:sts=2 iskeyword+=\:,\!,\<,\>,\-,\& 1" vim: noai:ts=2:sw=2:sts=2 iskeyword+=\:,\!,\<,\>,\-,\&
2 2
3"=======================================================================================================================
4" GENERAL:
5"=======================================================================================================================
6
3set textwidth=120 | " better done with modeline 7set textwidth=120 | " better done with modeline
4set ts=4 sts=4 sw=4 expandtab | " better done with a modeline 8set ts=4 sts=4 sw=4 expandtab | " better done with a modeline
5set redrawtime=1000 | " Timeout in milliseconds for redrawing the display / CTRL+L to retry 9set redrawtime=1000 | " Timeout in milliseconds for redrawing the display / CTRL+L to retry
6 10
7" scripts from the default vim installation, which do not get loaded by default, but are useful. 11if filereadable("/bin/bash")
8" silent :runtime macros/editexisting.vim 12 set shell=/bin/bash | " many scripts rely on bash, but its path varies why it is commented out here
9packadd! editexisting 13elseif filereadable("/usr/local/bin/bash")
14 set shell=/usr/local/bin/bash
15endif
10 16
11if has("multi_byte") 17if has("multi_byte")
12 scriptencoding utf-8 | " tell vim that we are using utf-8 here 18 scriptencoding utf-8 | " tell vim that we are using utf-8 here
@@ -30,6 +36,82 @@ if has("multi_byte")
30" set fillchars+=stlnc:\― | " 36" set fillchars+=stlnc:\― | "
31end 37end
32 38
39if has('persistent_undo')
40 set undofile | " preserve undo history when closing and reopening buffers (see :help undo-persistenece)
41
42 if isdirectory('/dev/shm')
43 set undodir=/dev/shm/ | " save undo file in memory. That is volatile, but fast and we have GIT for longer lasting undos
44 elseif isdirectory('/tmp/')
45 set undodir=/tmp/
46 endif
47endif
48
49" scripts from the default vim installation, which do not get loaded by default, but are useful.
50if filereadable('macros/editexisting')
51 silent :runtime macros/editexisting.vim
52endif
53
54
55"=======================================================================================================================
56if has('cscope') " compiled with cscope support?
57 " http://vim.wikia.com/wiki/Cscope
58 set cscopetag | " CTRL-] uses cscope first, then ctags
59 set cscopeverbose
60
61 if has('quickfix')
62 set cscopequickfix=s+,c+,d+,i+,t+,e+
63 endif
64
65 if has('menu')
66 menu &CScope.add
67 \ :cscope add .<CR>
68
69 menu &CScope.show
70 \ :cscope show<CR>
71
72 menu &CScope.reset
73 \ :cscope reset<CR>
74
75 menu &CScope.-Sep-
76 \ :
77
78 menu &Cscope.find.C\ symbol
79 \ :cscope find s <cword><CR>
80
81 menu &Cscope.find.definition
82 \ :cscope find g <cword><CR>
83
84 menu &Cscope.find.functions\ called\ by\ this
85 \ :cscope find d <cword><CR>
86
87 menu &Cscope.find.functions\ calling\ this
88 \ :cscope find c <cword><CR>
89
90 menu &Cscope.find.text\ string
91 \ :cscope find t <cword><CR>
92
93 menu &Cscope.find.egrep\ pattern
94 \ :cscope find e <cword><CR>
95
96 menu &Cscope.find.this\ file
97 \ :cscope find f <cword><CR>
98
99 menu &Cscope.find.files\ including\ this\ file
100 \ :cscope find i <cword><CR>
101
102 menu &Cscope.find.places\ where\ this\ symbol\ is\ assigned\ a\ value
103 \ :cscope find a <cword><CR>
104 endif
105 " cnoreabbrev csa cs add
106 " cnoreabbrev csf cs find
107 " cnoreabbrev csk cs kill
108 " cnoreabbrev csr cs reset
109 " cnoreabbrev css cs show
110 " cnoreabbrev csh cs help
111 let @c = ":cs find s <cword>"
112endif
113
114
33" ======================================================================================================================= 115" =======================================================================================================================
34" SETTINGS: 116" SETTINGS:
35" ======================================================================================================================= 117" =======================================================================================================================
@@ -96,307 +178,7 @@ set equalalways | " do not evenly size windows when opening new or
96set nocursorline | " turn visual cursor line off (improves performance) 178set nocursorline | " turn visual cursor line off (improves performance)
97"======================================================================================================================= 179"=======================================================================================================================
98 180
99if has('persistent_undo')
100 set undofile | " preserve undo history when closing and reopening buffers (see :help undo-persistenece)
101
102 if isdirectory('/dev/shm')
103 set undodir=/dev/shm/ | " save undo file in memory. That is volatile, but fast and we have GIT for longer lasting undos
104 elseif isdirectory('/tmp/')
105 set undodir=/tmp/
106 endif
107endif
108
109" START: LOADING PLUGINS
110" ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
111call plug#begin()
112
113Plug 'tpope/vim-surround' | " plugin makes cs"' inside a line replace " with '
114Plug 'tpope/vim-fugitive' | " the most complete GIT integration plugin
115Plug 'godlygeek/tabular' | " align code on a sign, like :Tab/=
116Plug 'mhinz/vim-signify' | " uses the sign column to indicate added, modified and removed lines
117let g:signify_vcs_list = [ 'git' ] | " use signify only with git (improves speed when loading buffers, see :h signify)
118let g:signify_cursorhold_insert = 1
119let g:signify_cursorhold_normal = 1
120let g:signify_update_on_bufenter = 0
121let g:signify_update_on_focusgained = 1
122
123" TESTING: | " plugins which I am currently trying...
124" Plug 'rkitover/vimpager'
125" found this command instead (use as PAGER):
126" man -P 'nvim -R -u NORC -c":%!col -b" -c":set buftype=nowrite filetype=man" -' ls
127"
128" Plug 'Shougo/neocomplete.vim' | " alternative to YouCompleteMe in some cases
129" Plug 'tpope/vim-characterize' | " normal mode: make ga show character names of Unicode chars (ga shows hex and dec values)
130
131" Colorschemes:
132Plug 'chriskempson/base16-vim' | " not just one high quality color scheme (all named base16-*)
133" Plug 'ryanoasis/vim-devicons' | " eye candy icons
134
135" SCRATCH: | " Unobtrusive scratch window
136Plug 'mtth/scratch.vim'
137nnoremap <F2> :ScratchPreview<CR>
138
139" BUFEXPLORER: | " a buffer to list all buffers has the advantage, that default /-searches work in there
140Plug 'jlanzarotta/bufexplorer'
141nnoremap <F12> :ToggleBufExplorer<CR>
142
143" NERDTree: replaces NetRW, as long as it has so many bugs
144Plug 'scrooloose/nerdtree' | "
145let NERDTreeIgnore = ['\.aux$']
146let NERDTreeCascadeSingleChildDir = 0 | " I don't get how one can use <m> to create files in that included directory
147let NERDTreeChDirMode = 0
148let NERDTreeHiddenFirst = 1
149let NERDTreeMinimalUI = 1
150let NERDTreeShowBookmarks = 1 | " show bookmarks by default (when opening for the first time)
151let NERDTreeWinSize = 40
152
153
154" depending on if NERDTree has the focus:
155nnoremap <expr>
156 \ <leader><leader>
157 \ bufwinnr("%")==g:NERDTree.GetWinNum() ? ':NERDTreeClose<CR>' : ':NERDTreeFind<CR>'
158nnoremap <expr>
159 \ <Tab>
160 \ bufwinnr("%")==g:NERDTree.GetWinNum() ? '<C-W><C-W>' : ':bn<CR>'
161nnoremap <expr>
162 \ <S-Tab>
163 \ bufwinnr("%")==g:NERDTree.GetWinNum() ? '<C-W><C-W>' : ':bp<CR>'
164" close NERDTree if it is the last remaining window (taken from the official documentation)
165" autocmd bufenter *
166" \ if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
167"
168
169" Additional: ========================================.
170Plug 'sheerun/vim-polyglot' " better syntax highlighting/indentation for multiple languages
171let g:javascript_conceal_function = "ƒ"
172let g:javascript_conceal_null = "ø"
173let g:javascript_conceal_this = "@"
174let g:javascript_conceal_return = "⇚"
175let g:javascript_conceal_undefined = "¿"
176let g:javascript_conceal_NaN = "ℕ"
177let g:javascript_conceal_prototype = "¶"
178let g:javascript_conceal_static = "•"
179let g:javascript_conceal_super = "Ω"
180let g:javascript_conceal_arrow_function = "⇒"
181
182Plug 'majutsushi/tagbar' " superseeds taglist-plus, which isn't maintained any more
183let g:tagbar_autoclose = 0
184let g:tagbar_autofocus = 1
185let g:tagbar_autoshowtag = 0
186let g:tagbar_compact = 1
187let g:tagbar_indent = 0
188let g:tagbar_foldlevel = 99
189nnoremap <leader>l :TagbarToggle<CR>| " bind TagBar to Hotkey Ctrl+L
190nnoremap <F9> :TagbarToggle<CR>| " also bind TagBar to Hotkey F9
191
192
193" AIRLINE: a fancy status line =========================================================================================
194set laststatus=2 | " required by AirLine, without status line does not appear until a window split
195set background=light
196
197Plug 'itchyny/lightline.vim'
198Plug 'taohex/lightline-buffer'
199
200" lightline-buffer ui settings
201" replace these symbols with ascii characters if your environment does not support unicode
202let g:lightline_buffer_logo = ' '
203let g:lightline_buffer_readonly_icon = ''
204let g:lightline_buffer_modified_icon = '✭'
205let g:lightline_buffer_git_icon = ' '
206let g:lightline_buffer_ellipsis_icon = '..'
207let g:lightline_buffer_expand_left_icon = '◀ '
208let g:lightline_buffer_expand_right_icon = ' ▶'
209let g:lightline_buffer_active_buffer_left_icon = ''
210let g:lightline_buffer_active_buffer_right_icon = ''
211let g:lightline_buffer_separator_icon = ' '
212
213" lightline-buffer function settings
214let g:lightline_buffer_show_bufnr = 0
215let g:lightline_buffer_rotate = 0
216let g:lightline_buffer_fname_mod = ':t'
217let g:lightline_buffer_excludes = ['vimfiler']
218let g:lightline_buffer_maxflen = 30
219let g:lightline_buffer_maxfextlen = 3
220let g:lightline_buffer_minflen = 16
221let g:lightline_buffer_minfextlen = 3
222let g:lightline_buffer_reservelen = 20
223
224let g:lightline = {
225 \ 'colorscheme': 'Tomorrow_Night_Bright',
226 \ 'separator': { 'left': "\ue0b0", 'right': "\ue0b2" },
227 \ 'subseparator': { 'left': "\ue0b1", 'right': "\ue0b3" },
228 \ 'active': {
229 \ 'left': [ [ 'mode', 'paste', 'readonly' ],
230 \ [ 'gitbranch', 'absolutepath' ],
231 \ [ 'tagbar' ] ],
232 \ 'right': [ [ 'lineinfo', 'percent' ],
233 \ [ 'spell', 'fileencoding', 'fileformat', 'filetype' ] ],
234 \ },
235 \ 'tabline': {
236 \ 'left': [ [ 'bufferinfo' ], [ 'bufferbefore', 'buffercurrent', 'bufferafter' ], ],
237 \ 'right': [ [ 'close' ] ],
238 \ },
239 \ 'component': {
240 \ 'tagbar': '%{tagbar#currenttag("%s", "", "fs")}',
241 \ },
242 \ 'component_expand': {
243 \ 'buffercurrent': 'lightline#buffer#buffercurrent2',
244 \ },
245 \ 'component_type': {
246 \ 'buffercurrent': 'tabsel',
247 \ },
248 \ 'component_function': {
249 \ 'bufferbefore': 'lightline#buffer#bufferbefore',
250 \ 'bufferafter': 'lightline#buffer#bufferafter',
251 \ 'bufferinfo': 'lightline#buffer#bufferinfo',
252 \ 'getcwd': 'getcwd',
253 \ 'gitbranch': 'fugitive#head'
254 \ },
255 \ }
256
257" Autocompleter: =====================================
258if has("python")
259 " YouCompleteMe: =====================================================================================================
260 " Plug 'Valloric/MatchTagAlways' " highlights the closing tag/brace/...
261 Plug 'Valloric/YouCompleteMe'
262 " Plug 'vim-scripts/dbext.vim' " dependency to allow db related completions
263 let g:ycm_server_python_interpreter = "python3"
264 let g:ycm_add_preview_to_completeopt = 1 " reuse existing preview window
265 let g:ycm_autoclose_preview_window_after_insertion = 1
266 let g:ycm_collect_identifiers_from_tags_files = 0 " Let YCM read tags from Ctags file
267 let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword
268 let g:ycm_complete_in_comments = 1 " Completion in comments
269 let g:ycm_complete_in_strings = 1 " Completion in string
270 let g:ycm_error_symbol = '✖' " insert this as an error symbol in the gutter bar
271 let g:ycm_min_num_of_chars_for_completion = 1
272 let g:ycm_use_ultisnips_completer = 1 " Default 1, just ensure
273 let g:ycm_warning_symbol = '➔' " insert this as a warning symbol in the gutter bar
274 let g:ycm_confirm_extra_conf = 0 " security is overrated
275 let g:ycm_key_list_select_completion = ['<Down>']
276 let g:ycm_key_list_previous_completion = ['<Up>']
277 let g:ycm_global_ycm_extra_conf = '.ycm_extra_conf.py'
278 let g:ycm_semantic_triggers = { 'c': [ 're!.' ] }
279 let g:ycm_python_binary_path = 'python' " the python interpreter of choice (for code checking)
280 " let g:ycm_disable_for_files_larger_than_kb = 16384 " we have faaast computers, don't we?
281
282 " disable <tab>-key for YCM so that it can be used with ultisnips
283 let g:ycm_key_list_select_completion=[]
284 let g:ycm_key_list_previous_completion=[]
285
286
287 " SYNTASTIC: =========================================================================================================
288 Plug 'scrooloose/syntastic'
289 set statusline+=%#warningmsg#
290 set statusline+=%{SyntasticStatuslineFlag()}
291 let g:LatexBox_latexmk_preview_continuously = 1
292 let g:LatexBox_viewer = "evince"
293 let g:syntastic_always_populate_loc_list = 1
294 let g:syntastic_auto_loc_list = 0
295 let g:syntastic_check_on_open = 1
296 let g:syntastic_check_on_wq = 0
297 " let g:syntastic_quiet_messages = {"type":"style"}
298 "
299 " E221: multiple spaces before Operator
300 let g:syntastic_python_flake8_args = '--max-complexity=10 --max-line-length=120 --exclude venv --doctests --exit-zero --ignore=E221'
301 " filter ( = do not display) style/formatting errors and warnings
302 let g:syntastic_error_symbol = '✖'
303 let g:syntastic_style_error_symbol = '✗'
304 let g:syntastic_warning_symbol = '➔'
305 let g:syntastic_style_warning_symbol = '≈'
306
307 " ULTISNIPS: code snippet ==============================================================================================
308 Plug 'honza/vim-snippets' " dependency of ultisnips (see below)
309 Plug 'SirVer/ultisnips' " replaces loremipsum (and many more)
310 "let g:UltiSnipsExpandTrigger = '<C-j>'| " Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
311 "let g:UltiSnipsJumpForwardTrigger = '<C-j>'| " \
312 "let g:UltiSnipsJumpBackwardTrigger = '<C-k>'| " \
313 "let g:UltiSnipsListSnippets = '<C-`>'| " YouCompleteMe includes those, so this isn't necessary
314 "let g:UltiSnipsExpandTrigger = '<leader><tab>'| " Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
315 "let g:UltiSnipsJumpForwardTrigger = '<PageDown>'| " \
316 "let g:UltiSnipsJumpBackwardTrigger = '<PageUp>'| " \
317 "let g:UltiSnipsListSnippets = '<leader><leader>'| " YouCompleteMe includes those, so this isn't necessary
318
319 " Plug 'rhysd/vim-clang-format'
320 Plug 'kana/vim-operator-user' " dependency, which allows overriding the = operator for indentation
321 autocmd FileType c,cpp,objc map <buffer> = :pyf /usr/share/clang/clang-format.py<CR>
322 " let g:clang_format#detect_style_file = 1
323 " autocmd FileType c,cpp,objc map <buffer> = <Plug>(operator-clang-format)
324
325 " JEDI: ==============================================================================================================
326 Plug 'davidhalter/jedi-vim' " jedi gets used to display python function signatures
327 let g:jedi#completions_enabled = 0 " we do not need completions, because we have YouCompleteMe
328 let g:jedi#show_call_signatures = 1 " which sadly does not support signatures like jedi
329 let g:jedi#show_call_signatures_delay = 0
330 let g:jedi#auto_vim_configure = 0
331 let g:pymode_rope = 0 " https://github.com/davidhalter/jedi-vim/issues/163
332 " autocmd FileType python jedi.preload_module('os', 'sys', 'math')
333 " let g:pymode_options_max_line_length = 120
334 " let g:syntastic_python_flake8_args='--ignore=F821,E302,E501,E241,E301'
335endif
336
337
338call plug#end() | " all plugins are getting loaded on this line, don't remove!
339" ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
340" END: LOADING PLUGINS
341
342
343" COLORSCHEME:
344" uses the default terminal background color as background (allows transparency)
345function! ExtendColorTheme()
346 " let g:colors_name=""
347 " set background=light
348 filetype on
349 filetype plugin on
350 filetype indent on
351
352 syntax on | " enable syntax highlighting
353 syntax sync minlines=60 | " how many preceding lines will be parsed? (has performance impact)
354 " highlight Normal ctermbg=NONE ctermfg=black
355
356 highlight! CursorLineNr cterm=inverse | " ctermbg=black ctermfg=NONE
357 highlight! Pmenu ctermbg=LightYellow ctermfg=blue
358 highlight! PmenuSel ctermbg=blue ctermfg=LightYellow cterm=bold
359
360 highlight! link PmenuSbar Pmenu
361 highlight! PmenuThumb cterm=inverse
362 highlight! MoreMsg cterm=inverse
363 highlight! link Folded LineNr
364 highlight! Cursor guibg=#729fcf ctermbg=yellow
365 highlight! link VertSplit LineNr
366 highlight! SpellBad ctermbg=none
367 highlight! SpecialKey ctermfg=19
368 highlight! WhiteSpace ctermfg=19
369
370 highlight! link TabLine LineNr
371 highlight! TabLineSel ctermbg=blue ctermfg=black
372 highlight! link TabLineFill LineNr
373 highlight! Search ctermbg=12 ctermfg=0
374endfunction
375autocmd ColorScheme * call ExtendColorTheme()
376
377
378if filereadable(expand("~/.config/base16-shell/colortest"))
379 let g:base16_shell_path="~/.config/base16-shell/scripts"
380endif
381 181
382let base16colorspace=256
383if filereadable(expand("~/.vimrc_background"))
384 source ~/.vimrc_background
385else
386 colorscheme base16-phd
387endif
388
389
390
391"=======================================================================================================================
392" GENERAL:
393"=======================================================================================================================
394
395if filereadable("/bin/bash")
396 set shell=/bin/bash | " many scripts rely on bash, but its path varies why it is commented out here
397elseif filereadable("/usr/local/bin/bash")
398 set shell=/usr/local/bin/bash
399endif
400 182
401 183
402"======================================================================================================================= 184"=======================================================================================================================
@@ -406,7 +188,7 @@ let g:spellfile_URL='http://ftp.vim.org/vim/runtime/spell'
406set nospell | " disable spell checker by default 188set nospell | " disable spell checker by default
407set spelllang=en,de | " languages for the spell checker 189set spelllang=en,de | " languages for the spell checker
408set spellsuggest=10 | " how many words will z= suggest? 190set spellsuggest=10 | " how many words will z= suggest?
409set thesaurus+=/home/max/.vim/thesaurus/php.txt 191set thesaurus+=~/.vim/thesaurus/php.txt
410 192
411set dictionary=/usr/share/dict/cracklib-small 193set dictionary=/usr/share/dict/cracklib-small
412set complete+=k " make default completer <C-N> respect the dictionary 194set complete+=k " make default completer <C-N> respect the dictionary
@@ -419,24 +201,6 @@ if has('autocmd')
419 autocmd VimLeave * silent !echo -ne "\033]112\007" 201 autocmd VimLeave * silent !echo -ne "\033]112\007"
420endif 202endif
421 203
422"=======================================================================================================================
423if has('cscope') " compiled with cscope support?
424 " http://vim.wikia.com/wiki/Cscope
425 set cscopetag | " CTRL-] uses cscope first, then ctags
426 set cscopeverbose
427
428 if has('quickfix')
429 set cscopequickfix=s+,c+,d+,i+,t+,e+
430 endif
431
432 " cnoreabbrev csa cs add
433 " cnoreabbrev csf cs find
434 " cnoreabbrev csk cs kill
435 " cnoreabbrev csr cs reset
436 " cnoreabbrev css cs show
437 " cnoreabbrev csh cs help
438 let @c = ":cs find s <cword>"
439endif
440 204
441" GUI_VERSION: 205" GUI_VERSION:
442if has("gui_running") 206if has("gui_running")
@@ -471,6 +235,10 @@ if !has('nvim') | " settings which have been removed from neovim
471 " 235 "
472 let g:loaded_ruby_provider = 1 " disable ruby support 236 let g:loaded_ruby_provider = 1 " disable ruby support
473 let g:loaded_python_provider = 1 " disable pthon3 237 let g:loaded_python_provider = 1 " disable pthon3
238
239 if version >= 702 " clean up (see: http://vim.wikia.com/wiki/VimTip396)
240 autocmd BufWinLeave * call clearmatches()
241 endif
474endif 242endif
475 243
476if has("autocmd") 244if has("autocmd")
@@ -642,11 +410,6 @@ if has("autocmd")
642 410
643 menu &Verify.Highlight\ current\ file\ name 411 menu &Verify.Highlight\ current\ file\ name
644 \ :execute ':match ColorColumn /'.escape(expand('%:t'), '.').'/'<CR> 412 \ :execute ':match ColorColumn /'.escape(expand('%:t'), '.').'/'<CR>
645
646
647 menu &CScope.add
648 \ :cscope add .<CR>
649
650 menu &Window.-Sep- : 413 menu &Window.-Sep- :
651 414
652 menu &Window.Quickfix\ List 415 menu &Window.Quickfix\ List
@@ -721,9 +484,242 @@ if has('nvim') " only neovim...
721 nnoremap <leader>t :new +terminal<CR> 484 nnoremap <leader>t :new +terminal<CR>
722endif 485endif
723 486
487
488
489" START: LOADING PLUGINS
490" ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
491call plug#begin()
492
493Plug 'tpope/vim-surround' | " plugin makes cs"' inside a line replace " with '
494Plug 'tpope/vim-fugitive' | " the most complete GIT integration plugin
495Plug 'godlygeek/tabular' | " align code on a sign, like :Tab/=
496Plug 'mhinz/vim-signify' | " uses the sign column to indicate added, modified and removed lines
497let g:signify_vcs_list = [ 'git' ] | " use signify only with git (improves speed when loading buffers, see :h signify)
498let g:signify_cursorhold_insert = 1
499let g:signify_cursorhold_normal = 1
500let g:signify_update_on_bufenter = 0
501let g:signify_update_on_focusgained = 1
502
503" TESTING: | " plugins which I am currently trying...
504" Plug 'rkitover/vimpager'
505" found this command instead (use as PAGER):
506" man -P 'nvim -R -u NORC -c":%!col -b" -c":set buftype=nowrite filetype=man" -' ls
507"
508" Plug 'Shougo/neocomplete.vim' | " alternative to YouCompleteMe in some cases
509" Plug 'tpope/vim-characterize' | " normal mode: make ga show character names of Unicode chars (ga shows hex and dec values)
510
511" Colorschemes:
512Plug 'chriskempson/base16-vim' | " not just one high quality color scheme (all named base16-*)
513" Plug 'ryanoasis/vim-devicons' | " eye candy icons
514
515" SCRATCH: | " Unobtrusive scratch window
516Plug 'mtth/scratch.vim'
517nnoremap <F2> :ScratchPreview<CR>
518
519" BUFEXPLORER: | " a buffer to list all buffers has the advantage, that default /-searches work in there
520Plug 'jlanzarotta/bufexplorer'
521nnoremap <F12> :ToggleBufExplorer<CR>
522
523" NERDTree: replaces NetRW, as long as it has so many bugs
524Plug 'scrooloose/nerdtree' | "
525let NERDTreeIgnore = ['\.aux$']
526let NERDTreeCascadeSingleChildDir = 0 | " I don't get how one can use <m> to create files in that included directory
527let NERDTreeChDirMode = 0
528let NERDTreeHiddenFirst = 1
529let NERDTreeMinimalUI = 1
530let NERDTreeShowBookmarks = 1 | " show bookmarks by default (when opening for the first time)
531let NERDTreeWinSize = 40
532
533
534" depending on if NERDTree has the focus:
535nnoremap <expr>
536 \ <leader><leader>
537 \ bufwinnr("%")==g:NERDTree.GetWinNum() ? ':NERDTreeClose<CR>' : ':NERDTreeFind<CR>'
538nnoremap <expr>
539 \ <Tab>
540 \ bufwinnr("%")==g:NERDTree.GetWinNum() ? '<C-W><C-W>' : ':bn<CR>'
541nnoremap <expr>
542 \ <S-Tab>
543 \ bufwinnr("%")==g:NERDTree.GetWinNum() ? '<C-W><C-W>' : ':bp<CR>'
544" close NERDTree if it is the last remaining window (taken from the official documentation)
545" autocmd bufenter *
546" \ if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
547"
548
549" Additional: ========================================.
550Plug 'sheerun/vim-polyglot' " better syntax highlighting/indentation for multiple languages
551let g:javascript_conceal_function = "ƒ"
552let g:javascript_conceal_null = "ø"
553let g:javascript_conceal_this = "@"
554let g:javascript_conceal_return = "⇚"
555let g:javascript_conceal_undefined = "¿"
556let g:javascript_conceal_NaN = "ℕ"
557let g:javascript_conceal_prototype = "¶"
558let g:javascript_conceal_static = "•"
559let g:javascript_conceal_super = "Ω"
560let g:javascript_conceal_arrow_function = "⇒"
561
562Plug 'majutsushi/tagbar' " superseeds taglist-plus, which isn't maintained any more
563let g:tagbar_autoclose = 0
564let g:tagbar_autofocus = 1
565let g:tagbar_autoshowtag = 0
566let g:tagbar_compact = 1
567let g:tagbar_indent = 0
568let g:tagbar_foldlevel = 99
569nnoremap <leader>l :TagbarToggle<CR>| " bind TagBar to Hotkey Ctrl+L
570nnoremap <F9> :TagbarToggle<CR>| " also bind TagBar to Hotkey F9
571
572
573" AIRLINE: a fancy status line =========================================================================================
574set laststatus=2 | " required by AirLine, without status line does not appear until a window split
575set background=light
576
577Plug 'itchyny/lightline.vim'
578Plug 'taohex/lightline-buffer'
579
580" lightline-buffer ui settings
581" replace these symbols with ascii characters if your environment does not support unicode
582let g:lightline_buffer_logo = ' '
583let g:lightline_buffer_readonly_icon = ''
584let g:lightline_buffer_modified_icon = '✭'
585let g:lightline_buffer_git_icon = ' '
586let g:lightline_buffer_ellipsis_icon = '..'
587let g:lightline_buffer_expand_left_icon = '◀ '
588let g:lightline_buffer_expand_right_icon = ' ▶'
589let g:lightline_buffer_active_buffer_left_icon = ''
590let g:lightline_buffer_active_buffer_right_icon = ''
591let g:lightline_buffer_separator_icon = ' '
592
593" lightline-buffer function settings
594let g:lightline_buffer_show_bufnr = 0
595let g:lightline_buffer_rotate = 0
596let g:lightline_buffer_fname_mod = ':t'
597let g:lightline_buffer_excludes = ['vimfiler']
598let g:lightline_buffer_maxflen = 30
599let g:lightline_buffer_maxfextlen = 3
600let g:lightline_buffer_minflen = 16
601let g:lightline_buffer_minfextlen = 3
602let g:lightline_buffer_reservelen = 20
603
604let g:lightline = {
605 \ 'colorscheme': 'Tomorrow_Night_Bright',
606 \ 'separator': { 'left': "\ue0b0", 'right': "\ue0b2" },
607 \ 'subseparator': { 'left': "\ue0b1", 'right': "\ue0b3" },
608 \ 'active': {
609 \ 'left': [ [ 'mode', 'paste', 'readonly' ],
610 \ [ 'gitbranch', 'absolutepath' ],
611 \ [ 'tagbar' ] ],
612 \ 'right': [ [ 'lineinfo', 'percent' ],
613 \ [ 'spell', 'fileencoding', 'fileformat', 'filetype' ] ],
614 \ },
615 \ 'tabline': {
616 \ 'left': [ [ 'bufferinfo' ], [ 'bufferbefore', 'buffercurrent', 'bufferafter' ], ],
617 \ 'right': [ [ 'close' ] ],
618 \ },
619 \ 'component': {
620 \ 'tagbar': '%{tagbar#currenttag("%s", "", "fs")}',
621 \ },
622 \ 'component_expand': {
623 \ 'buffercurrent': 'lightline#buffer#buffercurrent2',
624 \ },
625 \ 'component_type': {
626 \ 'buffercurrent': 'tabsel',
627 \ },
628 \ 'component_function': {
629 \ 'bufferbefore': 'lightline#buffer#bufferbefore',
630 \ 'bufferafter': 'lightline#buffer#bufferafter',
631 \ 'bufferinfo': 'lightline#buffer#bufferinfo',
632 \ 'getcwd': 'getcwd',
633 \ 'gitbranch': 'fugitive#head'
634 \ },
635 \ }
636
637" Autocompleter: =====================================
638if has("python")
639 " YouCompleteMe: =====================================================================================================
640 " Plug 'Valloric/MatchTagAlways' " highlights the closing tag/brace/...
641 Plug 'Valloric/YouCompleteMe'
642 " Plug 'vim-scripts/dbext.vim' " dependency to allow db related completions
643 let g:ycm_server_python_interpreter = "python3"
644 let g:ycm_add_preview_to_completeopt = 1 " reuse existing preview window
645 let g:ycm_autoclose_preview_window_after_insertion = 1
646 let g:ycm_collect_identifiers_from_tags_files = 0 " Let YCM read tags from Ctags file
647 let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword
648 let g:ycm_complete_in_comments = 1 " Completion in comments
649 let g:ycm_complete_in_strings = 1 " Completion in string
650 let g:ycm_error_symbol = '✖' " insert this as an error symbol in the gutter bar
651 let g:ycm_min_num_of_chars_for_completion = 1
652 let g:ycm_use_ultisnips_completer = 1 " Default 1, just ensure
653 let g:ycm_warning_symbol = '➔' " insert this as a warning symbol in the gutter bar
654 let g:ycm_confirm_extra_conf = 0 " security is overrated
655 let g:ycm_key_list_select_completion = ['<Down>']
656 let g:ycm_key_list_previous_completion = ['<Up>']
657 let g:ycm_global_ycm_extra_conf = '.ycm_extra_conf.py'
658 let g:ycm_semantic_triggers = { 'c': [ 're!.' ] }
659 let g:ycm_python_binary_path = 'python' " the python interpreter of choice (for code checking)
660 " let g:ycm_disable_for_files_larger_than_kb = 16384 " we have faaast computers, don't we?
661
662 " disable <tab>-key for YCM so that it can be used with ultisnips
663 let g:ycm_key_list_select_completion=[]
664 let g:ycm_key_list_previous_completion=[]
665
666
667 " SYNTASTIC: =========================================================================================================
668 Plug 'scrooloose/syntastic'
669 set statusline+=%#warningmsg#
670 set statusline+=%{SyntasticStatuslineFlag()}
671 let g:LatexBox_latexmk_preview_continuously = 1
672 let g:LatexBox_viewer = "evince"
673 let g:syntastic_always_populate_loc_list = 1
674 let g:syntastic_auto_loc_list = 0
675 let g:syntastic_check_on_open = 1
676 let g:syntastic_check_on_wq = 0
677 " let g:syntastic_quiet_messages = {"type":"style"}
678 "
679 " E221: multiple spaces before Operator
680 let g:syntastic_python_flake8_args = '--max-complexity=10 --max-line-length=120 --exclude venv --doctests --exit-zero --ignore=E221'
681 " filter ( = do not display) style/formatting errors and warnings
682 let g:syntastic_error_symbol = '✖'
683 let g:syntastic_style_error_symbol = '✗'
684 let g:syntastic_warning_symbol = '➔'
685 let g:syntastic_style_warning_symbol = '≈'
686
687 " ULTISNIPS: code snippet ==============================================================================================
688 Plug 'honza/vim-snippets' " dependency of ultisnips (see below)
689 Plug 'SirVer/ultisnips' " replaces loremipsum (and many more)
690 "let g:UltiSnipsExpandTrigger = '<C-j>'| " Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
691 "let g:UltiSnipsJumpForwardTrigger = '<C-j>'| " \
692 "let g:UltiSnipsJumpBackwardTrigger = '<C-k>'| " \
693 "let g:UltiSnipsListSnippets = '<C-`>'| " YouCompleteMe includes those, so this isn't necessary
694 "let g:UltiSnipsExpandTrigger = '<leader><tab>'| " Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
695 "let g:UltiSnipsJumpForwardTrigger = '<PageDown>'| " \
696 "let g:UltiSnipsJumpBackwardTrigger = '<PageUp>'| " \
697 "let g:UltiSnipsListSnippets = '<leader><leader>'| " YouCompleteMe includes those, so this isn't necessary
698
699 " Plug 'rhysd/vim-clang-format'
700 Plug 'kana/vim-operator-user' " dependency, which allows overriding the = operator for indentation
701 autocmd FileType c,cpp,objc map <buffer> = :pyf /usr/share/clang/clang-format.py<CR>
702 " let g:clang_format#detect_style_file = 1
703 " autocmd FileType c,cpp,objc map <buffer> = <Plug>(operator-clang-format)
704
705 " JEDI: ==============================================================================================================
706 Plug 'davidhalter/jedi-vim' " jedi gets used to display python function signatures
707 let g:jedi#completions_enabled = 0 " we do not need completions, because we have YouCompleteMe
708 let g:jedi#show_call_signatures = 1 " which sadly does not support signatures like jedi
709 let g:jedi#show_call_signatures_delay = 0
710 let g:jedi#auto_vim_configure = 0
711 let g:pymode_rope = 0 " https://github.com/davidhalter/jedi-vim/issues/163
712 " autocmd FileType python jedi.preload_module('os', 'sys', 'math')
713 " let g:pymode_options_max_line_length = 120
714 " let g:syntastic_python_flake8_args='--ignore=F821,E302,E501,E241,E301'
715endif
716
717call plug#end() | " all plugins are getting loaded on this line, don't remove!
718" ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
719" END: LOADING PLUGINS
724" ====================================================================================================================== 720" ======================================================================================================================
725" Deprecated with this configuration, but still useful when deactivating some Plugins
726 721
722" Deprecated with this configuration, but still useful when deactivating some Plugins
727" NETRW: obsolete with NERDTree 723" NETRW: obsolete with NERDTree
728let g:netrw_alto = 0 | " open files on the right 724let g:netrw_alto = 0 | " open files on the right
729let g:netrw_altv = 1 | " open files on the right 725let g:netrw_altv = 1 | " open files on the right
@@ -737,7 +733,55 @@ let g:netrw_liststyle = 3 | " 3=tree
737let g:netrw_preview = 0 | " 733let g:netrw_preview = 0 | "
738let g:netrw_winsize = 20 | " window size in percent 734let g:netrw_winsize = 20 | " window size in percent
739 735
736" ======================================================================================================================
737" COLORSCHEME:
738" uses the default terminal background color as background (allows transparency)
739function! ExtendColorTheme()
740 " let g:colors_name=""
741 " set background=light
742 filetype on
743 filetype plugin on
744 filetype indent on
740 745
746 syntax on | " enable syntax highlighting
747 syntax sync minlines=60 | " how many preceding lines will be parsed? (has performance impact)
748 " highlight Normal ctermbg=NONE ctermfg=black
749
750 highlight! CursorLineNr cterm=inverse | " ctermbg=black ctermfg=NONE
751 highlight! Pmenu ctermbg=LightYellow ctermfg=blue
752 highlight! PmenuSel ctermbg=blue ctermfg=LightYellow cterm=bold
753
754 highlight! link PmenuSbar Pmenu
755 highlight! PmenuThumb cterm=inverse
756 highlight! MoreMsg cterm=inverse
757 highlight! link Folded LineNr
758 highlight! Cursor guibg=#729fcf ctermbg=yellow
759 highlight! link VertSplit LineNr
760 highlight! SpellBad ctermbg=none
761 highlight! SpecialKey ctermfg=19
762 highlight! WhiteSpace ctermfg=19
763
764 highlight! link TabLine LineNr
765 highlight! TabLineSel ctermbg=blue ctermfg=black
766 highlight! link TabLineFill LineNr
767 highlight! Search ctermbg=12 ctermfg=0
768endfunction
769autocmd! ColorScheme * call ExtendColorTheme()
770
771
772if filereadable(expand("~/.config/base16-shell/colortest"))
773 let g:base16_shell_path="~/.config/base16-shell/scripts"
774endif
775
776let base16colorspace=256
777if filereadable(expand("~/.vimrc_background"))
778 source ~/.vimrc_background
779else
780 colorscheme base16-phd
781endif
782
783
784" ======================================================================================================================
741highlight WordBold ctermbg=LightYellow ctermfg=black cterm=bold gui=bold guibg=LightYellow guifg=black 785highlight WordBold ctermbg=LightYellow ctermfg=black cterm=bold gui=bold guibg=LightYellow guifg=black
742let w:m1 = 0 786let w:m1 = 0
743function! HighlightWordUnderCursor() 787function! HighlightWordUnderCursor()
@@ -751,11 +795,7 @@ function! HighlightWordUnderCursor()
751 silent! call matchadd('WordBold', '\<'.l:currentword.'\>', -1, w:m1) 795 silent! call matchadd('WordBold', '\<'.l:currentword.'\>', -1, w:m1)
752 endif 796 endif
753endfunction 797endfunction
754
755autocmd! CursorHold,CursorHoldI * call HighlightWordUnderCursor() 798autocmd! CursorHold,CursorHoldI * call HighlightWordUnderCursor()
756if version >= 702 " clean up (see: http://vim.wikia.com/wiki/VimTip396)
757 autocmd BufWinLeave * call clearmatches()
758endif
759 799
760 800
761" avoids openin an empty buffer when restoring bufferlist from viminfo... 801" avoids openin an empty buffer when restoring bufferlist from viminfo...
@@ -774,4 +814,5 @@ endif
774" autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS 814" autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
775" autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags 815" autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
776" 816"
817"
777" set termguicolors 818" set termguicolors
..