aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vimrc-custom-statusline1214
1 files changed, 1214 insertions, 0 deletions
diff --git a/vimrc-custom-statusline b/vimrc-custom-statusline
new file mode 100644
index 0000000..46ddbe9
--- /dev/null
+++ b/vimrc-custom-statusline
@@ -0,0 +1,1214 @@
1" vim: noai:ts=2:sw=2:sts=2 iskeyword+=\:,\!,\<,\>,\-,\& number
2
3"=======================================================================================================================
4" GENERAL:
5"=======================================================================================================================
6set exrc | " enable exrc, a specific .exrc per project, which can contain usual .vimrc commands
7set textwidth=0 | " better done with modeline or local exrc and not here
8set ts=4 sts=4 sw=4 expandtab | " better done with a modeline or local exrc
9set virtualedit=all | " virtual edit should be default behaviour, because I don't see any reason against
10set nonumber norelativenumber | " do not show numbers by default, because that causes a performance loss, instead activate them on a file type basis
11set ignorecase smartcase hlsearch | " search with ignore case by default, but use case sensitive search when one capital char is contained and highlight while typing (even though its slower)
12set cindent cinoptions+=(0 | " indent at parentheses
13
14
15set path+=** | " allow recursive searches for files
16let &path = &path.",/usr/lib/modules/".substitute(system('uname -r'), "\n", "", "")."/build/include"
17
18"=======================================================================================================================
19" SHELL
20"=======================================================================================================================
21if filereadable("/bin/bash")
22 set shell=/bin/bash | " many scripts rely on bash, but its path varies why it is commented out here
23elseif filereadable("/usr/local/bin/bash")
24 set shell=/usr/local/bin/bash
25endif
26
27"=======================================================================================================================
28" Persistent undo
29"=======================================================================================================================
30if has('persistent_undo')
31 if isdirectory('/dev/shm')
32 set undodir=/dev/shm/ | " save undo file in memory. That is volatile, but fast and we have GIT for longer lasting undoes
33 set directory=/dev/shm/ | " swap file directory to RAM
34 set swapfile
35 elseif isdirectory('/tmp/')
36 set undodir=/tmp/
37 endif
38 set undofile | " preserve undo history when closing and reopening buffers (see :help undo-persistence)
39endif
40
41"=======================================================================================================================
42" multi byte
43"=======================================================================================================================
44if has("multi_byte")
45 scriptencoding utf-8 | " tell vim that we are using UTF-8 here
46 set encoding=utf-8 | " we need default UTF-8 encoding to use cool chars as line break and so on (see below)
47 let &termencoding=&encoding | " once we use special chars we assume everybody uses a terminal supporting those
48
49 set fillchars+=fold:\ | "
50 set fillchars+=vert:\║ | " cool vertical split char
51 set fillchars+=diff:\ | " a white space gets used here
52
53 set listchars= | " initialize empty listchars
54 set listchars+=extends:» | " symbols used when using :set list (which displays non-printable chars)
55 set listchars+=precedes:« | " symbols used when using :set list (which displays non-printable chars)
56
57 set listchars+=tab:▏\ | "
58 set listchars+=trail:· | " symbols used when using :set list (which displays non-printable chars)
59 " set listchars+=eol:↲ | " symbols used when using :set list (which displays non-printable chars)
60 " set listchars+=space:· | " symbols used when using :set list (which displays non-printable chars)
61 set showbreak+=› | " symbol used in the beginning of a wrapped line
62
63 " automatically enter list mode when going in insert mode (makes above syntax command temporarily ineffective)
64 set nolist
65 autocmd InsertEnter * set list
66 autocmd InsertLeave * set nolist
67" set fillchars+=stlnc:\― | "
68end
69
70
71"=======================================================================================================================
72" SPELL_CHECKING
73"=======================================================================================================================
74let g:spellfile_URL='http://ftp.vim.org/vim/runtime/spell'
75" add local user default spell file as primary source for words
76let &spellfile=fnamemodify($MYVIMRC, ":p:h")."/spell/spellfile-user.UTF-8.add"
77
78set nospell | " disable spell checker by default
79set spelllang=en,de | " languages for the spell checker
80set spellsuggest=10 | " how many words will z= suggest?
81set thesaurus+=~/.vim/thesaurus/php.txt
82
83"=======================================================================================================================
84" cscope
85"=======================================================================================================================
86" http://vim.wikia.com/wiki/Cscope
87if has('cscope') " compiled with cscope support?
88 set cscopetag " CTRL-] uses cscope first, then ctags
89 set cscopeverbose
90
91 if has('quickfix')
92 set cscopequickfix=s+,c+,d+,i+,t+,e+
93 endif
94
95 if has('menu')
96 1001menu &Cscope.find.c\ symbol
97 \<tab>s
98 \ :cscope find s <cword><:cR>
99 1001menu &Cscope.find.definition
100 \<tab>g
101 \ :cscope find g <cword><:cR>
102 1001menu &Cscope.find.functions\ called\ by\ this
103 \<tab>d
104 \ :cscope find d <cword><:cR>
105 1001menu &Cscope.find.functions\ calling\ this
106 \<tab>c
107 \ :cscope find c <cword><:cR>
108 1001menu &Cscope.find.text\ string
109 \<tab>t
110 \ :cscope find t <cword><:cR>
111 1001menu &Cscope.find.egrep\ pattern
112 \<tab>e
113 \ :cscope find e <cword><:cR>
114 1001menu &Cscope.find.this\ file
115 \<tab>f
116 \ :cscope find f <cword><:cR>
117 1001menu &Cscope.find.files\ including\ this\ file
118 \<tab>i
119 \ :cscope find i <cword><:cR>
120 1001menu &Cscope.find.places\ where\ this\ symbol\ is\ assigned\ a\ value
121 \<tab>a
122 \ :cscope find a <cword><:cR>
123 1001menu &Cscope.-Sep1-
124 \ :
125 1001menu &Cscope.create\ and\ add\ database
126 \ :cscope kill -1<CR>:execute '!find -type f -regex ".*\.\(c\\|h\\|cpp\\|cxx\\|hh\\|hpp\\|hxx\)$" <bar> cscope -i- -b -q -v'<CR>:cscope add .<CR>
127 1001menu &Cscope.-Sep2-
128 \ :
129 1001menu &Cscope.add\ \.
130 \ :cscope add .<CR>
131 1001menu &Cscope.show
132 \ :cscope show<CR>
133 1001menu &Cscope.reset
134 \ :cscope reset<CR>
135 endif
136endif
137
138" ======================================================================================================================
139" GUI_VERSION
140" ======================================================================================================================
141if has("gui_running")
142 set guicursor=a:block-blinkon100
143 set browsedir=buffer
144 set toolbar+=text
145 set guiheadroom=0
146 set guioptions+=eig
147 set guioptions-=T | " toolbar
148 set guioptions+=c | " use console dialogues instead of popups
149 set guioptions+=a | " auto select: copy&paste using middle click
150 set guioptions+=m | " remove menu
151 set guioptions-=e | " do not display tabs
152 set guioptions-=L | " do not show left scrollbar
153 set guioptions-=r | " do not show right scrollbar
154 set winaltkeys=menu | " behave like other windows: ALT-key can be used to open the menu (and cannot be :remaped)
155" set selectmode=mouse,key,cmd | " enters vim's select mode when pressing shift-left or shift-END
156" set keymodel=startsel,stopsel | " makes shift-left, shift-right available for selecting text
157
158
159 " its possible to define alternative fonts (order matters)
160 set guifont=Hasklug\ Nerd\ Font\ Mono\ Semi-Bold\ 10
161 set guifont+=Hasklig\ Semi-Bold\ 10
162 set guifont+=Bitstream\ Vera\ Sans\ Mono\ 10
163 set guifont+=Monospace\ 10
164 set guifont+=FuraMono\ Nerd\ Font\ Mono\ Medium\ 11
165 set guifont+=Source\ Code\ Pro\ for\ Powerline\ SemiBold\ 10
166 set guifont+=LiterationMono\ Nerd\ Font\ Mono\ 10
167 set guifont+=RobotoMono\ Nerd\ Font\ Medium\ 10
168 set guifont+=Source\ Code\ Pro\ Semi-Bold\ 10
169 set guifont+=Dejavu\ Sans\ Mono\ for\ Powerline\ Semibold
170 set guifont+=Droid\ Sans\ Mono\ for\ Powerline\ 10
171 set guifont+=Meslo\ LG\ M\ for\ Powerline\ 10
172
173 " like in the terminal: use Ctrl-shift-v for paste in vim's command editor
174 cnoremap <c-s-v> <c-r>*
175endif
176
177" ======================================================================================================================
178" SETTINGS:
179" ======================================================================================================================
180set breakindent | " Every wrapped line will continue visually indented
181set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well)
182set concealcursor=nc | " limits the display of concealed text to normal and command mode
183set conceallevel=2 | " replace escaped chars by their UTF-8 representation (useful for LaTeX)
184set confirm | " asks 'do you want to save?'
185set cpoptions+=P | " makes :w filename set the current buffer to filename
186set hidden | " allows switching buffers even if the current buffer contains changes (displays +)
187set linebreak | " wrap long lines at char 'breakat', not inside words
188set mousemodel=popup | " only in gvim: right click opens a pop-up-menu
189set mouse=n | " allow mouse in normal mode only, so one can use the terminals c&p feature in insert mode
190set noautochdir | " When on, Vim will change the current working directory
191set nostartofline | " when scrolling: do not move the cursor to column 1
192set nowrap | " but do not (by default) wrap long lines around
193set nrformats+=alpha | " allows CTRL-A & CTRL-X to increment and decrement letters, not just numbers
194set incsearch | " highlight pattern while entering it (performance wise this isn't that good)
195
196if has('nvim') " Neovim?
197set inccommand=nosplit | " preview substitute and such things in real time
198endif
199
200set pumheight=8 | " Determines the maximum number of items to show in the pop-up menu for
201set scrolljump=5 | " how many lines get scrolled into view when cursor reaches the screens edge
202set scrolloff=0 | " keeps cursor centered
203set shiftround | " indent/un-indent snaps to multiple of shiftwidths
204set writedelay=0
205
206" display and performance
207set lazyredraw | " disables redraw during macro execution (improves performance)
208set cmdheight=2 | " sets the command line's height
209set signcolumn=auto | " auto=auto hide, yes=always, no=never show the column with error indicators
210set nocursorcolumn | " turn visual cursor column off (improves performance)
211set updatetime=80 | " updates the screen more often
212set redrawtime=1500 | " Timeout in milliseconds for redrawing the screen (switches syntax off when ssh too slow) / CTRL+L to retry
213set notimeout | " improves performance but is known to cause problems on slow terminals
214set ttimeout ttimeoutlen=150 | " set Esc key timeout in ms-
215set showcmd | " essential: show keys of combined commands in the lower right corner (BUT SLOW, makes cursor flickering)
216set showtabline=2 | " 0: never, 1: only if there are at least two tabs, 2:always
217set shortmess+=I | " don't give the intro message when starting Vim |:intro|.
218set wildmenu | " use a menu in the command line
219set wildmode=longest:full | " do not preselect any entry and show all possible
220
221" code completion
222" set dictionary=/usr/share/dict/cracklib-small
223" set complete+=k " make default completer <C-N> respect the dictionary
224set complete-=u " scan current and included files
225set complete+=i " scan current and included files
226set complete+=d " scan current and included files for defined name or macro
227set complete+=d | " scan current and included files for defined name or macro
228set complete+=i | " scan current and included files for completions
229set tagcase=match | " tagcase match, because we mostly use ^] to jump around and that variant respects the upper/lower case [followscs, followic, match, ignore]
230set tags+=../tags
231
232" code folding...
233set nofoldenable | " disable folding, because we have zi to toggle foldenable :)
234set foldclose=all | " automatically fold, when the cursor leaves the folded area
235set foldcolumn=0 | " I think I don't need this second indicator
236" set foldmethod=syntax | " foldlevel: syntax, indent, manual / foldmethod=syntax makes Vim incredible slow
237set foldnestmax=1 | " top level folding only
238set foldopen=block,hor,search | " when do we unfold?
239" set foldtext=Foldtext() | "
240" set foldtext=v:folddashes.substitute(getline(v:foldstart),'\\v^/[/*]\','','g')
241" set foldtext='⊞\ '.substitute(getline(v:foldstart),'^[\ '.printf(&cms,'').']*','','').'↵'.getline(v:foldstart+1).'↵'.getline(v:foldstart+2)
242 set foldtext='⊞\ '.substitute(join(getline(v:foldstart,v:foldend),'↵'),'\[*\/\]','','g')
243
244" vim window behaviour
245set splitbelow | " open new windows below the current one (i find that more intuitive)
246set winminwidth=0 | " (and all other windows, so TODO: watch out)
247set winwidth=30 | " keep NERDTreeWindow at least this size
248
249
250" vim session handling and restore behaviour
251set viminfo+=% | " restore buffer list
252set sessionoptions=
253set sessionoptions+=buffers
254set sessionoptions+=curdir
255set sessionoptions+=folds
256set sessionoptions+=resize
257set sessionoptions+=slash
258set sessionoptions+=tabpages
259set sessionoptions+=unix
260set sessionoptions+=winpos
261set sessionoptions+=winsize
262
263
264" set nocindent smartindent | " use smart indent rather then cindent
265set noautoindent
266set nosmartindent
267
268set noshiftround | " indent/un-indent sna=ps to multiple of shiftwidths
269set noequalalways | " do not evenly size windows when opening new or closing old
270set nocursorline | " turn visual cursor line off (improves performance)
271"=======================================================================================================================
272
273" Vim 8 has a terminal command...
274if has('terminal')
275 " use default ESC key to leave insert mode in the internal terminal emulator
276 tnoremap <Esc> <C-W>N
277 " make terminal windows hidden by default (copied from :help terminal)
278 autocmd BufWinEnter * if &buftype == 'terminal' | setlocal bufhidden=hide | endif
279endif
280
281
282" NEOVIM_incompatible:
283"
284if has('nvim') " Neovim?
285 autocmd TermOpen term://* set nobuflisted
286 " use default ESC key to leave insert mode in the internal terminal emulator
287 tnoremap <Esc> <C-\><C-n>
288" set shada+=n~/.vim/shada | " shada file to use
289"
290 menu &UI.&Open\ in\ Serversession
291 \ :execute ':!nvr --servername /tmp/nvimsocket --remote % +'.line('.')<CR>:stopinsert<CR>:set readonly<CR>
292
293else " default Vim?
294 autocmd VimLeave * call system("echo -n $'" . escape(getreg(), "'") . "' | xsel -ib")
295
296 set ttymouse=xterm2
297 set ttyscroll=100 | " improves speed for terminal vim, incompatible with nvim
298 set ttyfast | " improves speed for terminal vim (incompatible with nvim)
299 set nottybuiltin | " use external termcaps
300 set restorescreen | " restores the console after exiting vim (intentionally not in nvim)
301 "
302 let g:loaded_ruby_provider = 1 " disable ruby support
303 let g:loaded_python_provider = 1 " disable python 3
304
305 if version >= 702 " clean up (see: http://vim.wikia.com/wiki/VimTip396)
306 autocmd BufWinLeave * call clearmatches()
307 endif
308
309
310 " scripts from the default vim installation, which do not get loaded by default, but are useful.
311 if filereadable($VIMRUNTIME.'/macros/editexisting.vim')
312 packadd! editexisting
313 endif
314
315 " load default plugin 'matchit' to allow % to jump between tags
316 if filereadable($VIMRUNTIME.'/macros/matchit.vim')
317 packadd! matchit
318 endif
319
320endif
321
322
323if has("autocmd")
324 set modeline | " set variables specific to a file, like indentation by adding a comment
325 " set default completion function in case YouCompleteMe cannot help
326 " set omnifunc=syntaxcomplete#Complete
327
328 augroup set_window_title " {
329 " autocmd BufEnter * let &titlestring = hostname() . "[vim(" . expand("%:t") . ")]"
330 autocmd CursorHold * let &titlestring = "%t %y ".$USER."@".hostname().":%{expand(\"%:~:.:h\")}"
331 set title
332 " autocmd CursorHold * let &titlestring = "Vim (".airline#extensions#tagbar#currenttag().")"
333
334 " set window title for screen(3)
335 if &term == "screen"
336 set t_ts=k
337 set t_fs=\
338 endif
339 if &term == "screen" || &term == "xterm"
340 set titlelen=40
341 set title
342 endif
343 augroup END
344
345 augroup ChangeIcon
346 "if filereadable("/usr/bin/xseticon")
347 "if filereadable("~/.vim/nvim.png")
348 " autocmd VimEnter * silent :execute "!xseticon -id $WINDOWID ~/.vim/nvim.png"
349 " autocmd VimLeave * silent :execute "!xseticon -id $WINDOWID /usr/share/icons/gnome/32x32/apps/xfce-terminal.png"
350 "endif
351 "endif
352 augroup END
353
354 " Fix terminal title =================================================================================================
355 " autocmd VimEnter * let &t_EI .= "\<Esc>[0 q"
356 " autocmd VimEnter * let &t_SI = "\<Esc>]12;green\x7"
357 autocmd VimLeave * silent !echo -ne "\033]112\007"
358
359 " highlight word under the cursor ====================================================================================
360 let w:m1 = 0
361 function! HighlightWordUnderCursor()
362 if(exists('w:m1') && w:m1 > 0)
363 silent! call matchdelete(w:m1)
364 let w:m1 = 0
365 endif
366 let l:currentword = escape(expand('<cword>'), '.')
367 if(strlen(l:currentword) > 0)
368 let w:m1=100
369 silent! call matchadd('BoldUnderline', '\<'.l:currentword.'\>', -1, w:m1)
370 endif
371 endfunction
372 autocmd! CursorHold,CursorHoldI * call HighlightWordUnderCursor()
373
374 " hitting K over a keyword shows a help in a buffer.
375 " Here we define the commands used to look those keywords up
376 " as per file type...
377 augroup filetype_specific
378 autocmd FileType python setlocal keywordprg=pydoc
379 autocmd FileType vim setlocal keywordprg=:help |.
380 autocmd FileType c,cpp setlocal equalprg=clang-format
381 autocmd FileType c,cpp setlocal breakat-=-
382
383 if filereadable("/usr/bin/vendor_perl/ack")
384 autocmd FileType c,cpp set grepprg=/usr/bin/vendor_perl/ack\ --type=cc\ --nogroup\ --column\ $*
385 autocmd FileType c,cpp set grepformat=%f:%l:%c:%m
386 endif
387
388 autocmd BufWinEnter * if &previewwindow | setlocal nonumber signcolumn=no filetype=c nobuflisted | endif
389
390
391 " autocmd FileType c,cpp setlocal iskeyword-=_
392
393 " the following helps to make file=/etc/something work with gf, but disallows filenames with an equal sign in them
394 autocmd FileType conf setlocal isfname-==
395
396
397 autocmd Filetype css command! CSSsort :g/{/+1;/}/-1 sort
398
399 " keyboard mapping for xml alike languages
400 " Alt-Up : Move cursor up one tag
401 " Alt-Down: Move cursor down one tag
402 " leader-=: tidies currently selected tag and subtags and sorts attributes by name (alphabetically)
403 autocmd Filetype html,markdown,xml iabbrev </ </<C-X><C-O>
404 autocmd Filetype html,htmldjango,xml
405 \ :nnoremap
406 \ <M-Down>
407 \ :call search('^ *<', 'e')<CR>:nohlsearch<CR>|
408 \ :nnoremap
409 \ <M-Up>
410 \ :call search('^ *<', 'eb')<CR>:nohlsearch<CR>|
411 \ :nnoremap
412 \ <leader>=
413 \ vat:'<,'>!tidy -xml --wrap 0 --sort-attributes alpha 2>/dev/null<CR>vat=
414 augroup END
415
416 " autocmd BufNewFile set nobuflisted
417 " use the shada/viminfo file to return the cursor to where it was...
418 autocmd BufReadPost * call setpos(".", getpos("'\""))
419
420 augroup CurrentFileName
421 " highlight the current files name inside the document...
422 let @g = ":exe ':match SpellBad /'.escape(expand('%:t'), '.').'/'"
423 " put the current files name after the cursor...
424 let @f = ":exe ':normal a'.expand('%:t')"
425
426 " grep all buffers for a given string and return result in a quickfix window
427 let @q = ":cex [] | bufdo vimgrepadd /foo/g % | cw"
428
429 let @l = ":let g:signify_vcs_cmds={'git': 'git diff --no-color --no-ext-diff -U0 HEAD^ -- %f'}|:SignifyRefresh"
430
431 if has('menu')
432 source $VIMRUNTIME/menu.vim
433 set wildmenu
434 set cpo-=<
435 set wcm=<C-Z>
436
437 01menu &Functions.toggle\ file\ browser
438 \<Tab><leader><leader>
439 \ <leader><leader>
440 01menu &Functions.-Sep0- :
441
442 01menu &Functions.help
443 \<Tab><F1>
444 \ <F1>
445 01menu &Functions.bp:\ previous\ buffer
446 \<Tab><F2>
447 \ <F2>
448 01menu &Functions.bn:\ next\ buffer
449 \<Tab><F3>
450 \ <F3>
451 01menu &Functions.^wc\:\ close\ window
452 \<Tab><F4>
453 \ <F4>
454 01menu &Functions.-Sep1- :
455
456 01menu &Functions.make
457 \<Tab><F5>
458 \ <F5>
459 01menu &Functions.clear\ matches,\ update\ viewport
460 \<Tab><F6>
461 \ <F6>
462 01menu &Functions.copen\:\ show\ quickfix\ list
463 \<Tab><F7>
464 \ <F7>
465 01menu &Functions.lopen\:\ show\ location\ list
466 \<Tab><F8>
467 \ <F8>
468 01menu &Functions.-Sep2- :
469
470 01menu &Functions.toggle\ tagbar
471 \<Tab><F9>
472 \ <F9>
473
474 if has("gui_running") == 0
475 " in the gui F10 already triggers the menu, not in a terminal vim, so upgrade that...
476 map <F10> :emenu <C-Z>
477 endif
478 01menu &Functions.activate\ menu\ (:emenu)
479 \<Tab><F10>
480 \ <F10>
481
482 01menu &Functions.undef11
483 \<Tab><F11>
484 \ <F11>
485 01menu &Functions.undef12
486 \<Tab><F12>
487 \ <F12>
488 01menu &Functions.-Sep2- :
489
490
491 09menu &Directory.print\ current\ directory
492 \<Tab>:pwd
493 \ :pwd<CR>
494
495 09menu &Directory.-Sep- :
496
497 09menu &Directory.Change\ to\ GIT\ root
498 \<Tab>:Gcd
499 \ :Gcd<CR>:pwd<CR>
500
501 09menu &Directory.Change\ to\ current\ buffers\ directory\ (global)
502 \<tab>:cd\ %:p:h
503 \ :cd %:h<CR>:pwd<CR>
504
505 09menu &Directory.Change\ to\ current\ buffers\ directory\ (local\ window)<tab>:lcd\ %:p:h
506 \ :lcd %:p:h<CR>:pwd<CR>
507
508 menu &Git.&Display\ last\ changes
509 \ :let g:signify_vcs_cmds={'git': 'git diff --no-color --no-ext-diff -U0 HEAD^ -- %f'}<CR>:SignifyRefresh<CR>
510 menu &Git.&Display\ significance\ of\ changes
511 \ :!git diff --stat HEAD~1..HEAD
512 menu &Git.&Display\ Changed\ files\ compared\ to\ master
513 \ :!git diff --name-status ..master
514
515 menu &Match.Clear\ All\ Matches
516 \<Tab><F6>
517 \ :call clearmatches()<CR>
518
519 menu &Match.-Sep- :
520
521 menu &Match.&dispensable\ white\ spaces
522 \ :call matchadd("Convention", '\s\+$', 0)<CR>
523
524 menu &Match.&long\ lines\ (exeeding\ textwidth)
525 \ :call matchadd("Convention", '\%>'.&textwidth.'v.', 0)<CR>
526
527 menu &Match.Highlight\ current\ file\ name
528 \ :call matchadd("Search", escape(expand('%:t'), '.'))<CR>
529
530 " :execute ':match SpellBad /'.escape(expand('%:t'), '.').'/'<CR>
531
532 menu &Window.-Sep- :
533
534
535 menu &Window.Scratch
536 \ :Scratch<CR>
537
538
539 menu &Find.file\ under\ the\ cursor
540 \<Tab>gf
541 \ gf
542
543 menu &Find.Open\ search\ results\ in\ location\ list
544 \<Tab>:gf
545 \ :execute ':vimgrep /'.escape(getreg('/'), '.').'/g %'<CR>
546 \ :copen<CR>
547
548 menu &Changes.list
549 \<Tab>:changes
550 \ :changes<CR>
551 menu &Changes.-Sep- :
552 menu &Changes.previous
553 \<Tab>g;
554 \ g;
555 menu &Changes.next
556 \<Tab>g,
557 \ g,
558
559 menu &Jump.list
560 \<Tab>:jumps
561 \ :jumps<CR>
562 menu &Jump.-Sep1- :
563 menu &Jump.previous\ position
564 \<Tab>CTRL-O
565 \ <C-O>
566 menu &Jump.next\ position
567 \<Tab>CTRL-I
568 \ <C-I>
569 menu &Jump.-Sep2- :
570 menu &Jump.clear\ list
571 \<Tab>:clearjumps
572 \ :clearjumps
573
574 1000menu &Tag.list
575 \<Tab>:tags
576 \ :tags<CR>
577 1000menu &Tag.selection\ list
578 \<Tab>:ts
579 \ :ts<CR>
580
581 1000menu &Tag.-Sep1- :
582
583 1000menu &Tag.stack.jump\ older
584 \<Tab><C-T>
585 \ :po
586 1000menu &Tag.stack.jump\
587 \<Tab>:ta
588 \ :ta
589 endif
590
591 " autocmd BufEnter * @f
592 augroup END
593
594 " autocmd VimEnter * set nobuflisted
595endif
596
597
598" ======================================================================================================================
599" SHORTCUTS: custom shortcuts
600" inoremap <C-Space> <C-x><C-o>
601" inoremap <C-@> <C-Space>
602
603" Bind CTRL+Backspace to vim's version (CTRL+W) in " <CR> insert mode (only works with gvim)
604inoremap
605 \ <C-Backspace>
606 \ <C-W>
607
608" INDENTATION: allows un-indenting a selected block and keeps selection
609vnoremap < <gv
610vnoremap > >gv
611
612" make shift-home select to the beginning of the line
613nnoremap <s-home> v^
614nnoremap <s-end> v$
615
616nnoremap <s-down> vj
617vnoremap <s-down> j
618nnoremap <s-up> vk
619vnoremap <s-up> k
620
621
622" close current buffer with <leader>q...
623nnoremap <leader>q :bp<bar>sp<bar>bn<bar>bd<CR>.
624" google the word under the cursor
625nnoremap <leader>G :execute ":!xdg-open https://google.de/search?q=".expand("<cword>")
626
627nnoremap <silent> <F5> :make!<CR>
628nnoremap <silent> <F6> :silent syntax sync fromstart<CR>:nohlsearch<CR>:silent match<CR>:silent 2match<CR>:silent 3match<CR>
629nnoremap <leader>r :syntax sync fromstart
630
631nnoremap <silent> <A-Up> :wincmd k<CR>
632nnoremap <silent> <A-Down> :wincmd j<CR>
633nnoremap <silent> <A-Left> :wincmd h<CR>
634nnoremap <silent> <A-Right> :wincmd l<CR>
635
636" INSERT_MODE_MAPPINGS:
637" default copy&paste insert key binding (just in insert mode, so it doesn't conflict
638" with visual block mode)- would have been nice, but collides with c-w for digraphs
639" inoremap <C-V> <C-R>+
640"
641inoremap <C-S> <C-O>:w<CR>
642
643" NEOVIM_SPECIFIC:
644if has('nvim') " only neovim...
645 " shortcut \t opens a terminal in a horizontal split
646 nnoremap <leader>t :new +terminal<CR>
647endif
648
649
650
651" ======================================================================================================================
652" START: LOADING PLUGINS
653" ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
654call plug#begin()
655" Colorschemes:
656Plug 'coderonline/vim-remote-menu'
657" Plug 'bbchung/clighter8'
658" Plug 'octol/vim-cpp-enhanced-highlight'
659" Plug 'vim-scripts/TagHighlight'
660" if ! exists('g:TagHighlightSettings')
661" let g:TagHighlightSettings = {}
662" endif
663" let g:TagHighlightSettings['TagFileName'] = 'tags'
664" let g:TagHighlightSettings['CtagsExecutable'] = 'ctags'
665
666Plug 'chriskempson/base16-vim' | " not just one high quality color scheme (all named base16-*)
667Plug 'NLKNguyen/papercolor-theme' | " the one I like the most
668
669Plug 'mhinz/vim-signify' | " uses the sign column to indicate added, modified and removed lines
670Plug 'tpope/vim-fugitive' | " the most complete GIT integration plugin
671Plug 'godlygeek/tabular' | " align code on a sign, like :Tab/=
672Plug 'severin-lemaignan/vim-minimap'
673Plug 'tpope/vim-surround' | " plugin makes cs"' inside a line replace " with '
674let g:signify_vcs_list = [ 'git' ] | " use signify only with git (improves speed when loading buffers, see :h signify)
675let g:signify_cursorhold_insert = 0
676let g:signify_cursorhold_normal = 0
677let g:signify_update_on_bufenter = 0
678let g:signify_update_on_focusgained = 0
679let g:signify_sign_show_count = 1
680
681" NERDTree: replaces NetRW, as long as it has so many bugs
682Plug 'scrooloose/nerdtree' | "
683let NERDTreeIgnore = ['\.aux$', '\.o$']
684let NERDTreeCascadeSingleChildDir = 0 | " I don't get how one can use <m> to create files in that included directory
685let NERDTreeChDirMode = 0
686let NERDTreeHiddenFirst = 1
687let NERDTreeMinimalUI = 1
688let NERDTreeShowBookmarks = 1 | " show bookmarks by default (when opening for the first time)
689let NERDTreeWinSize = 40
690let NERDTreeQuitOnOpen = 1
691
692" depending on if NERDTree has the focus:
693nnoremap <expr>
694 \ <leader><leader>
695 \ bufwinnr("%")==g:NERDTree.GetWinNum() ? ':NERDTreeClose<CR>' : ':NERDTreeFind<CR>'
696nnoremap <expr>
697 \ <F2>
698 \ bufwinnr("%")==g:NERDTree.GetWinNum() ? '<C-W><C-W>' : ':N<CR>'
699
700nnoremap <expr>
701 \ <F3>
702 \ bufwinnr("%")==g:NERDTree.GetWinNum() ? '<C-W><C-W>' : ':n<CR>'
703
704nnoremap <F4>
705 \ :wincmd c<CR>
706" close NERDTree if it is the last remaining window (taken from the official documentation)
707" autocmd bufenter *
708" \ if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
709"
710
711
712" map CTRL-PageUp/Down to next/previous buffer
713" and Shift-PageUp/Down to next/previous arglist file
714nnoremap <C-PageUp> :bn<CR>
715nnoremap <C-PageDown> :bp<CR>
716nnoremap <S-PageUp> :N<CR>
717nnoremap <S-PageDown> :n<CR>
718
719
720" Additional: ========================================.
721Plug 'sheerun/vim-polyglot' " better syntax highlighting/indentation for multiple languages
722let g:javascript_conceal_function = "ƒ"
723let g:javascript_conceal_null = "ø"
724let g:javascript_conceal_this = "@"
725let g:javascript_conceal_return = "⇚"
726let g:javascript_conceal_undefined = "¿"
727let g:javascript_conceal_NaN = "ℕ"
728let g:javascript_conceal_prototype = "¶"
729let g:javascript_conceal_static = "•"
730let g:javascript_conceal_super = "Ω"
731let g:javascript_conceal_arrow_function = "⇒"
732
733Plug 'majutsushi/tagbar' " superseeds taglist-plus, which isn't maintained any more
734let g:tagbar_autoclose = 0
735let g:tagbar_autofocus = 1
736let g:tagbar_autoshowtag = 0
737let g:tagbar_compact = 1
738let g:tagbar_indent = 0
739let g:tagbar_foldlevel = 99
740
741nnoremap <F9> :TagbarToggle<CR>| " bind TagBar to hotkey F9
742
743
744" LIGHTLINE: a fancy status line =======================================================================================
745"
746set noshowmode | " mode will be shown twice, in lightline and below, so we want to deactivate one
747set laststatus=2 | " required by AirLine and Lightline, without status line does not appear until a window split
748
749" set statusline=\ %##%{(&modified?nr2char(0xF0C7):'')}%{(&readonly\ ?\ ''\ :\ '')}%)%{fnamemodify(getcwd(),':~')}%{nr2char(0x20)}%{nr2char(0xE0B1)}%{nr2char(0x20)}%f%{nr2char(0xf05b)}%y%*%=%l:%c(%p%%)
750"
751
752
753set statusline=
754set statusline+=%#StatusLineHighlight#
755set statusline+=%1*
756set statusline+=%{(&readonly\ ?\ '\ \ \ '\ :\ '')}
757set statusline+=%{(&modified\ ?\ nr2char(0xF0C7).'\ '\ :\ '')}
758set statusline+=%(%w%h%q\ %-8{mode()}%)
759set statusline+=%{nr2char(0xE0BD)}
760set statusline+=%(\ %{fnamemodify(getcwd(),\ ':~')}\ %)
761set statusline+=%{nr2char(0xE0BD)}
762set statusline+=%(\ %f\ %)
763set statusline+=%2*
764set statusline+=%{nr2char(0xE0B4)\ }
765set statusline+=%0*
766
767set statusline+=%=
768
769set statusline+=%2*
770set statusline+=%{nr2char(0xE0B6)}
771set statusline+=%1*
772set statusline+=%{\ &filetype}
773set statusline+=%(\ %{nr2char(0xE0B9)}\ %)
774set statusline+=%{&fileencoding}
775set statusline+=%(\ %{nr2char(0xE0B9)}\ %)
776set statusline+=%{&fileformat}
777set statusline+=%(\ %{nr2char(0xE0B9)}\ %)
778set statusline+=%4l:%-4c
779set statusline+=%-3p%%
780
781
782set tabline=
783set tabline+=%1*
784set tabline+=%4(\ %)
785set tabline+=%(%{v:servername}\ %{v:this_session}%)
786set tabline+=%2*
787set tabline+=%{nr2char(0xE0B4)\ }
788
789set tabline+=%=
790
791set tabline+=%2*
792set tabline+=%{nr2char(0xE0B6)}
793set tabline+=%1*
794set tabline+=%(\ \ %{fugitive#head()}%)
795set tabline+=%(\ %{nr2char(0xE0B9)}\ %)
796set tabline+=%(\ %{tabpagenr()}/%{tabpagenr('$')}%)
797set tabline+=%##
798" set statusline+=%t%m
799" set statusline+=%{TagInStatusLine()}
800" set statusline+=%#warningmsg#
801" set statusline+=%{SyntasticStatuslineFlag()}
802
803" Plug 'itchyny/lightline.vim'
804
805" lightline-buffer ui settings
806" replace these symbols with ASCII characters if your environment does not support unicode
807let g:lightline_buffer_logo = ''
808let g:lightline_buffer_readonly_icon = ''
809let g:lightline_buffer_modified_icon = '✭'
810let g:lightline_buffer_git_icon = ' '
811let g:lightline_buffer_ellipsis_icon = '..'
812let g:lightline_buffer_active_buffer_left_icon = ' '
813let g:lightline_buffer_active_buffer_right_icon = ''
814" let g:lightline_buffer_separator_icon = 'XX'
815
816" lightline-buffer function settings
817let g:lightline_buffer_show_bufnr = 0
818let g:lightline_buffer_rotate = 0
819let g:lightline_buffer_fname_mod = ':t'
820let g:lightline_buffer_excludes = ['vimfiler']
821let g:lightline_buffer_maxflen = 30
822let g:lightline_buffer_maxfextlen = 3
823let g:lightline_buffer_minflen = 16
824let g:lightline_buffer_minfextlen = 3
825let g:lightline_buffer_reservelen = 20
826
827" \ ['warnings', 'errors', 'syntastic']
828" \ 'left': [ [ 'bufferinfo' ], [ 'bufferbefore', 'buffercurrent', 'bufferafter' ], ],
829let g:lightline = {
830 \ 'tabline': {
831 \ 'left': [ [ 'servername', 'sessionname' ] ],
832 \ 'right': [ [], ['gitbranch', 'tabnumber'] ],
833 \ },
834 \ 'colorscheme': 'Tomorrow_Night',
835 \ 'separator': { 'left': "\uE0B4", 'right': "\uE0B6" },
836 \ 'subseparator': { 'left': "\uE0b1", 'right': "\uE0b3" },
837 \ 'inactive': {
838 \ 'left': [ [ 'pwd', 'relativepath'] ],
839 \ 'right': []
840 \ },
841 \ 'active': {
842 \ 'left': [ [ 'mode', 'register', 'paste' ], [ 'pwd', 'relativepath' ] , ['tagbar']],
843 \ 'right': [ [ 'lineinfo', 'percent' ], [ 'filetype', 'readonly', 'spell', 'fileencoding', 'fileformat' ] ]
844 \ },
845 \ 'component': {
846 \ 'tagbar': '%{substitute(tagbar#currenttag("%s", "", "fs"), "\(.*\)", "", "")}',
847 \ 'ycmparent': '%{substitute(execute("YcmComplete GetParent"), "\(.*\)", "", "")}',
848 \ 'filename': '%t',
849 \ 'buffer_alt': '%{expand("#:t")}',
850 \ 'servername': ' %{v:servername}',
851 \ 'sessionname': '%{v:this_session}',
852 \ 'gitbranch': ' %{fugitive#head()}',
853 \ 'tabnumber': " %{tabpagenr()}/%{tabpagenr('$')}",
854 \ 'readonly': '%{&readonly ? "" : ""}',
855 \ 'register': '%{v:register}',
856 \ 'title': '%{getwinvar(0, "quickfix_title")}',
857 \ 'pwd': '%{fnamemodify(getcwd(), ":~")}',
858 \ 'relativepath': '%{fnamemodify(expand("%"), ":.")}'
859 \ },
860 \ 'component_expand': {
861 \ 'buffercurrent': 'lightline#buffer#buffercurrent2',
862 \ 'syntastic': 'SyntasticStatuslineFlag',
863 \ },
864 \ 'component_function': {
865 \ 'bufferinfo': 'lightline#buffer#bufferinfo',
866 \ 'warnings': 'youcompleteme#GetWarningCount',
867 \ 'errors': 'youcompleteme#GetErrorCount',
868 \ },
869 \ }
870
871
872" Autocompleter: =====================================
873if has("python")
874
875 " ULTISNIPS: code snippet ============================================================================================
876 Plug 'honza/vim-snippets' " dependency of ultisnips (see below)
877 Plug 'SirVer/ultisnips' " replaces loremipsum (and many more)
878 " let g:UltiSnipsExpandTrigger = '<Tab>'| " expands the snippet, be careful not to use <tab> elsewhere (ycm uses it by default, but it has been deactivated by g:ycm_key_list_select_completion)
879 let g:UltiSnipsExpandTrigger = '<Tab>'| " expands the snippet, be careful not to use <tab> elsewhere (ycm uses it by default, but it has been deactivated by g:ycm_key_list_select_completion)
880
881 let g:UltiSnipsJumpForwardTrigger = '<Tab>'|
882 let g:UltiSnipsJumpBackwardTrigger = '<S-Tab>'|
883 "d let g:UltiSnipsJumpForwardTrigger = '<PageDown>'
884 " let g:UltiSnipsJumpBackwardTrigger = '<PageUp>'
885 "let g:UltiSnipsExpandTrigger = '<C-j>'| " Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
886 "let g:UltiSnipsJumpForwardTrigger = '<C-j>'| " \
887 "let g:UltiSnipsJumpBackwardTrigger = '<C-k>'| " \
888 "let g:UltiSnipsListSnippets = '<C-`>'| " YouCompleteMe includes those, so this isn't necessary
889 "let g:UltiSnipsListSnippets = '<leader><leader>'| " YouCompleteMe includes those, so this isn't necessary
890 """ Ultisnips
891 " let g:UltiSnipsExpandTrigger="<c-tab>"
892 " let g:UltiSnipsListSnippets="<c-s-tab>"
893
894 if has('nvim')
895 Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
896 " Use deoplete.
897 let g:deoplete#enable_at_startup = 1
898 inoremap <silent><expr> <C-Space> deoplete#mappings#manual_complete()
899
900 Plug 'Shougo/echodoc.vim'
901 let g:echodoc#enable_at_startup = 1
902
903 " Plug 'Rip-Rip/clang_complete'
904 " Plug 'tweekmonster/deoplete-clang2'
905 " Plug 'zchee/deoplete-clang'
906 " let g:deoplete#sources#clang#libclang_path = "/usr/lib/libclang.so"
907 " let g:deoplete#sources#clang#clang_header = "/usr/lib/clang/6.0.0"
908 " let g:deoplete#sources#clang#std#cpp = 'c++1z'
909 " let g:deoplete#sources#clang#clang_complete_database = "/home/max/src"
910 " Plug 'Shougo/neoinclude.vim' " makes vim slow - unfortunatelly
911
912 Plug 'autozimu/LanguageClient-neovim', {
913 \ 'branch': 'next',
914 \ 'do': 'bash install.sh',
915 \ }
916
917 let g:LanguageClient_serverCommands = {
918 \ 'cpp': ['clangd']
919 \ }
920 " Plug 'roxma/nvim-completion-manager' unmaintained python version
921 else
922 Plug 'idanarye/vim-vebugger'
923
924 " YouCompleteMe: =====================================================================================================
925 " Plug 'Valloric/MatchTagAlways' " highlights the closing tag/brace/...
926 Plug 'Valloric/YouCompleteMe', {
927 \ 'do' : 'python install.py --clang-completer',
928 \ }
929 let g:ycm_error_symbol = '✖' " insert this as an error symbol in the gutter bar/sign column
930 let g:ycm_warning_symbol = '➔' " insert this as a warning symbol in the gutter bar/sign coloumn
931
932 let g:ycm_autoclose_preview_window_after_insertion = 0
933 let g:ycm_auto_trigger = 1
934 let g:ycm_collect_identifiers_from_tags_files = 1 " Let YCM read tags from Ctags file
935 let g:ycm_confirm_extra_conf = 0 " security is overrated ;)
936
937 let g:ycm_key_list_previous_completion = ['Up']
938 let g:ycm_key_list_select_completion = ['Down']
939
940 " Plug 'vim-scripts/dbext.vim' " dependency to allow db related completions
941 " let g:ycm_server_python_interpreter = 'python3'
942 " let g:ycm_python_binary_path = '/usr/bin/python3' " the python interpreter of choice (for code checking)
943 " let g:ycm_add_preview_to_completeopt = 1 " reuse existing preview window
944 " let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword
945 " let g:ycm_complete_in_comments = 1 " Completion in comments
946 " let g:ycm_complete_in_strings = 1 " Completion in string
947 " let g:ycm_min_num_of_chars_for_completion = 6 " we normally avoid identifier based completion, it just helps with long words. Use semantic completions with <C-Space> instead (terrible idea, html snippets not working!)
948 " let g:ycm_min_num_identifier_candidate_chars = 4
949 " let g:ycm_max_num_identifier_candidates = 10
950 " let g:ycm_max_num_candidates = 50
951 " let g:ycm_use_ultisnips_completer = 1 " Default 1, just ensure
952 " let g:ycm_key_list_select_completion = ['<Down>']
953 " let g:ycm_key_list_previous_completion = ['<Up>']
954 " let g:ycm_global_ycm_extra_conf = '.ycm_extra_conf.py'
955 " let g:ycm_semantic_triggers = { 'c': [ 're!.' ] }
956 " " let g:ycm_disable_for_files_larger_than_kb = 16384 " we have faaast computers, don't we?
957 " let g:ycm_show_diagnostics_ui = 0
958 " " disable <tab>-key for YCM so that it can be used with ultisnips
959 " let g:ycm_key_list_select_completion=[]
960 " let g:ycm_key_list_previous_completion=[]
961 endif
962
963
964 " SYNTASTIC: =========================================================================================================
965 if has('nvim')
966 Plug 'w0rp/ale'
967 let g:ale_set_highlights = 0
968 highlight! link ALEWarningSign FoldColumn
969 let g:ale_sign_error = ''
970 let g:ale_sign_style_error = ''
971 let g:ale_sign_info = ''
972 let g:ale_sign_warning = ''
973 else
974 Plug 'scrooloose/syntastic'
975 set statusline+=%#warningmsg#
976 set statusline+=%{SyntasticStatuslineFlag()}
977 let g:LatexBox_latexmk_preview_continuously = 1
978 let g:LatexBox_viewer = "evince"
979 let g:syntastic_always_populate_loc_list = 1
980 let g:syntastic_auto_loc_list = 0
981 let g:syntastic_check_on_open = 1
982 let g:syntastic_check_on_wq = 0
983 " let g:syntastic_quiet_messages = {"type":"style"}
984 "
985 " E221: multiple spaces before Operator
986 let g:syntastic_python_flake8_args = '--max-complexity=10 --max-line-length=120 --exclude venv --doctests --exit-zero --ignore=E221'
987 " filter ( = do not display) style/formatting errors and warnings
988 let g:syntastic_error_symbol = '✖'
989 let g:syntastic_style_error_symbol = '✗'
990 let g:syntastic_warning_symbol = '➔'
991 let g:syntastic_style_warning_symbol = '≈'
992 endif
993
994 " JEDI: ==============================================================================================================
995 Plug 'davidhalter/jedi-vim' " jedi gets used to display python function signatures
996 let g:jedi#completions_enabled = 0 " we do not need completions, because we have YouCompleteMe
997 let g:jedi#show_call_signatures = 1 " which sadly does not support signatures like jedi
998 let g:jedi#show_call_signatures_delay = 0
999 let g:jedi#auto_vim_configure = 0
1000 let g:pymode_rope = 0 " https://github.com/davidhalter/jedi-vim/issues/163
1001 " autocmd FileType python jedi.preload_module('os', 'sys', 'math')
1002 " let g:pymode_options_max_line_length = 120
1003 " let g:syntastic_python_flake8_args='--ignore=F821,E302,E501,E241,E301'
1004
1005endif " has("python")
1006
1007"=======================================================================================================================
1008" TESTING: | " plugins which I am currently trying...
1009"=======================================================================================================================
1010" Plug 'rhysd/vim-clang-format' | unnecessary, because we can just :pyf /usr/share/clang/clang-format.py
1011Plug 'kana/vim-operator-user' " dependency, which allows overriding the = operator for indentation
1012
1013" TODO: check if this is unrequired, when set equalprog is set to that py file
1014autocmd FileType c,cpp,objc map <buffer> = :pyf /usr/share/clang/clang-format.py<CR>
1015
1016" let g:clang_format#detect_style_file = 1
1017" autocmd FileType c,cpp,objc map <buffer> = <Plug>(operator-clang-format)
1018
1019" Plug 'tpope/vim-characterize' | " normal mode: make ga show character names of Unicode chars (ga shows hex and dec values)
1020" Plug 'rkitover/vimpager'
1021" found this command instead (use as PAGER):
1022" man -P 'nvim -R -u NORC -c":%!col -b" -c":set buftype=nowrite filetype=man" -' ls
1023
1024command BuffersToArg :exec ':args '.join(map(range(0, bufnr('$')), 'fnameescape(fnamemodify(bufname(v:val), ":."))'))
1025command BufToArg :argadd %:.
1026
1027"=======================================================================================================================
1028call plug#end() | " all plugins are getting loaded on this line, don't remove!
1029
1030" ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
1031" END: LOADING PLUGINS
1032" ======================================================================================================================
1033
1034" Deprecated with this configuration, but still useful when deactivating some Plugins
1035" NETRW: obsolete with NERDTree
1036let g:netrw_alto = 0 | " open files on the right
1037let g:netrw_altv = 1 | " open files on the right
1038let g:netrw_banner = 0 | " display help messages?
1039let g:netrw_browse_split = 4 | " 4=open in previous window
1040let g:netrw_fastbrowse = 2 | " manually refresh direcory list (avoids display errors)
1041let g:netrw_hide = 1 | " show not-hidden files only
1042let g:netrw_keepdir = 0
1043let g:netrw_list_hide = '^\..*' | " Explore mode: hide files starting with dot
1044let g:netrw_liststyle = 3 | " 3=tree
1045let g:netrw_preview = 0 | "
1046let g:netrw_winsize = 20 | " window size in percent
1047
1048" ======================================================================================================================
1049" COLORSCHEME:
1050" ======================================================================================================================
1051
1052function! ExtendColorTheme()
1053 filetype on
1054 filetype plugin on
1055 filetype indent on
1056
1057 syntax on | " enable syntax highlighting
1058 syntax sync minlines=60 | " how many preceding lines will be parsed? (has performance impact)
1059
1060 " use the default terminal background color as background (allows transparency)
1061 " highlight! Normal guibg=NONE ctermbg=NONE
1062 " highlight! NonText guibg=NONE guifg=black ctermbg=NONE ctermfg=black
1063
1064 " make the ~ (tilde) indicator invisible, which usually marks the EOF
1065 highlight! link EndOfBuffer Ignore
1066
1067 highlight! CursorLineNr cterm=inverse | " ctermbg=black ctermfg=NONE
1068 highlight! Pmenu ctermbg=LightYellow ctermfg=DarkGrey
1069 highlight! PmenuSel ctermbg=blue ctermfg=LightYellow cterm=bold
1070
1071 highlight! link PmenuSbar Pmenu
1072 highlight! PmenuThumb cterm=inverse
1073 highlight! MoreMsg cterm=inverse
1074 highlight! link Folded LineNr
1075 highlight! Cursor guibg=#729fcf ctermbg=yellow
1076 highlight! link VertSplit LineNr
1077 " highlight! SpellBad ctermbg=none
1078 highlight! SpecialKey ctermfg=19
1079 highlight! WhiteSpace ctermfg=19
1080
1081 highlight! link TabLine LineNr
1082 highlight! TabLineSel ctermbg=blue ctermfg=black
1083 highlight! link TabLineFill LineNr
1084 highlight! Search ctermbg=LightYellow ctermfg=black guibg=#fefd86 guifg=#222222
1085 highlight! link WildMenu Search
1086
1087 " generic, which should exist but don't
1088 highlight! Bold cterm=bold gui=bold
1089 highlight! Italic cterm=italic gui=italic
1090 highlight! Underline cterm=underline gui=underline
1091 highlight! BoldUnderline cterm=bold,underline gui=bold,underline
1092 highlight! BoldItalic cterm=Bold,Italic gui=Bold,Italic
1093
1094 " make tab stop (see listchars) less disturbing...
1095 highlight! link SpecialKey NonText
1096
1097 " highlight! link LightlineMiddle_tabline ColorColumn
1098 " highlight! link LightlineLeft_tabline_1 ColorColumn
1099 " highlight! link LightlineLeft_tabline_0_1 ColorColumn
1100
1101 highlight! Todo guibg=#ffffaa guifg=#000000 gui=bold term=bold
1102 highlight! cStatement guifg=red gui=bold term=bold
1103
1104 highlight! link Convention Error
1105
1106 highlight! StatusLine gui=NONE guibg=NONE guifg=#ffff00
1107 highlight! StatusLineNC gui=NONE guibg=NONE
1108 " " highlight! StatusLineHighlight gui=inverse
1109 " " highlight! StatusLineInverse gui=NONE
1110 " highlight! link StatusLineHighlight StatusLineNC
1111 " highlight! link StatusLineInverse StatusLine
1112
1113 highlight! User1 guibg=NONE guifg=NONE gui=inverse
1114 highlight! User2 guibg=NONE guifg=NONE gui=NONE
1115
1116 " autocmd InsertLeave * call matchadd('Conceal', ' \+$', -1, 101, { 'conceal': '⟶' })
1117 autocmd InsertEnter * silent! call matchdelete(101)
1118 autocmd InsertLeave * call matchadd('Convention', ' \+$', -1, 101, { 'conceal': '⟶' })
1119
1120 " Show trailing whitepace and spaces before a tab as part of the syntax highlighting
1121 " autocmd BufEnter,InsertLeave * syntax match Convention /\s\+$\| \+\ze\t/ containedin=ALL
1122 " autocmd Syntax * syntax match Convention /\s\+$\| \+\ze\t/ containedin=ALL
1123 " autocmd BufEnter,BufWritePost * syntax match Convention /\s\+$\| \+\ze\t/ containedin=ALL
1124 " autocmd InsertEnter * syntax clear Convention
1125 " autocmd BufEnter,InsertLeave * execute ':syntax match Convention /\%>'.&textwidth.'v./ containedin=ALL'
1126
1127 autocmd InsertEnter * set colorcolumn=80,120
1128 autocmd InsertLeave * set colorcolumn&
1129 " set colorcolumn= | " not used, because we have a :match directive for textwidth
1130 "
1131" if argc() == 0
1132 " rv
1133 " autocmd VimEnter * split +bro\ ol
1134" endif
1135"
1136
1137endfunction
1138autocmd! ColorScheme * call ExtendColorTheme()
1139
1140
1141set termguicolors | " When on, uses highlight-guifg and highlight-guibg attributes in the terminal (=24bit color) incompatible with nvim
1142" set t_ut=
1143
1144if filereadable(expand("~/.vimrc_background")) && filereadable(expand("~/.config/base16-shell/colortest"))
1145 let g:base16_shell_path="~/.config/base16-shell/scripts"
1146 let base16colorspace=256
1147 let syntax_cmd="skip" " vim internal, use base16 and no default colors
1148 set background=dark
1149 source ~/.vimrc_background
1150else
1151 let g:PaperColor_Theme_Options = {
1152 \ 'theme': {
1153 \ 'default': {
1154 \ 'transparent_background': 1
1155 \ }
1156 \ }
1157 \ }
1158 set background=dark
1159 colorscheme PaperColor
1160endif
1161
1162" ======================================================================================================================
1163" CONVENIENCE:
1164" ======================================================================================================================
1165if empty(argv())
1166
1167 " autocmd VimEnter * call setloclist(0, filter(map(copy(v:oldfiles), {_, p->{'filename': expand(get(split(p, "'"), 0))}}), { val -> echo val}))
1168
1169 " from the list of recent files: make absolute paths, filter out files not
1170 " contained in cwd and finally filter out directories and non-files...
1171 autocmd StdinReadPre * let s:std_in=1
1172 autocmd VimEnter * if !exists("s:std_in") | call setqflist(map(filter(filter(
1173 \ map(copy(v:oldfiles), {_, p->expand(p)}), 'v:val =~ "'.getcwd().'"'),
1174 \ 'filereadable(v:val)'), {_, p->{'filename': fnamemodify(p, ':.')}})) | copen | only
1175endif
1176
1177command Vimls
1178 \ call setloclist(0, map(getbufinfo({'buflisted':1}),
1179 \ "{'bufnr': v:val.bufnr,
1180 \ 'lnum': v:val.lnum,
1181 \ 'text': '='.printf('%*s, % 3d: %s [%s]', winwidth(0) / 2, '', v:val.bufnr, v:val.name, getbufvar(v:val.bufnr, '&buftype')),
1182 \ 'pattern': 'not loaded'}
1183 \ "))
1184
1185command Ctoggle
1186 \ if(get(getqflist({'winid':1}), 'winid') == win_getid())|cclose|else|botright copen|endif
1187command Ltoggle
1188 \ if(get(getloclist(0, {'winid':1}), 'winid') == win_getid())|lclose|else|lopen|endif
1189
1190
1191
1192" nnoremap <silent> <ESC> :lclose<CR> " brings vim into REPLACE mode (R)
1193nnoremap <silent> <F7> :Ltoggle<CR>
1194nnoremap <silent> <F8> :Ctoggle<CR>
1195nnoremap <silent> <F12> :Vimls<CR>:Ltoggle<CR>
1196
1197" exec current line as a command, insert output of command (from: https://youtu.be/MquaityA1SM?t=35m45s)
1198nnoremap Q !!$SHELL<CR>
1199
1200
1201" ======================================================================================================================
1202" TESTING:
1203" ======================================================================================================================
1204" avoids openin an empty buffer when restoring bufferlist from viminfo...
1205" if argc() == 0
1206" silent autocmd VimEnter * nested :silent bun
1207" endif
1208
1209autocmd VimEnter,WinEnter * exec ':set scrolljump='.winheight(0)/2
1210
1211" display highlight group under the cursor
1212map <leader>h :echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')<CR>
1213
1214" call setqflist( map(systemlist("git show --name-only --pretty=''"), {_, p->{'filename': fnamemodify(p, ':.')}}))
..