aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Christian Pohle2018-05-13 18:36:47 +0200
committerMax Christian Pohle2018-05-13 18:36:47 +0200
commit039bbf24263aa5782d290410206eedfb9354b237 (patch)
tree81610b56f64e0efa17a94e77286ee45c9706dcf6
parent8caea9124e170fbf475b4e38b8f9fe74549eb847 (diff)
downloadvim-039bbf24263aa5782d290410206eedfb9354b237.tar.bz2
vim-039bbf24263aa5782d290410206eedfb9354b237.zip
Dropped lightline, now using a custom statusline
It displays everything what lightline did before, but I took special care to make it compatible with all colorschemes I am using.
-rw-r--r--vimrc-custom-statusline1221
-rw-r--r--vimrc-full176
2 files changed, 136 insertions, 1261 deletions
diff --git a/vimrc-custom-statusline b/vimrc-custom-statusline
deleted file mode 100644
index 19942cd..0000000
--- a/vimrc-custom-statusline
+++ /dev/null
@@ -1,1221 +0,0 @@
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(0xe621)}
760set statusline+=%(\ %{fnamemodify(getcwd(),\ ':~')}\ %)
761set statusline+=%{nr2char(0xf44a)}
762set statusline+=%(\ %f\ %)
763set statusline+=%2*
764set statusline+=%{nr2char(0xE0B4)\ }
765
766set statusline+=%=
767
768set statusline+=%2*
769set statusline+=%{nr2char(0xE0B6)}
770set statusline+=%1*
771set statusline+=%1(%) " a single space
772set statusline+=%{\ &filetype}
773set statusline+=%(\ %{nr2char(0xe621)}\ %)
774set statusline+=%{&fileencoding}
775set statusline+=%(\ %{nr2char(0xe621)}\ %)
776set statusline+=%{&fileformat}
777set statusline+=%(\ %{nr2char(0xe621)}\ %)
778set statusline+=%4l:%-4c
779set statusline+=%-3p%%
780
781
782set tabline=
783set tabline+=%1*
784set tabline+=%3(\ %)
785set tabline+=%{nr2char(0xe621)}
786set tabline+=%(%{v:servername}\ %{v:this_session}%)
787set tabline+=%2*
788set tabline+=%{nr2char(0xE0B4)\ }
789
790set tabline+=%=
791
792set tabline+=%2*
793set tabline+=%{nr2char(0xE0B6)}
794set tabline+=%1*
795set tabline+=%(\ \ %{fugitive#head()}\ %)
796set tabline+=%{nr2char(0xe621)}
797set tabline+=%(\ \ %{tabpagenr()}/%{tabpagenr('$')}\ %)
798set tabline+=%##
799" set statusline+=%t%m
800" set statusline+=%{TagInStatusLine()}
801" set statusline+=%#warningmsg#
802" set statusline+=%{SyntasticStatuslineFlag()}
803
804" Plug 'itchyny/lightline.vim'
805
806" lightline-buffer ui settings
807" replace these symbols with ASCII characters if your environment does not support unicode
808let g:lightline_buffer_logo = ''
809let g:lightline_buffer_readonly_icon = ''
810let g:lightline_buffer_modified_icon = '✭'
811let g:lightline_buffer_git_icon = ' '
812let g:lightline_buffer_ellipsis_icon = '..'
813let g:lightline_buffer_active_buffer_left_icon = ' '
814let g:lightline_buffer_active_buffer_right_icon = ''
815" let g:lightline_buffer_separator_icon = 'XX'
816
817" lightline-buffer function settings
818let g:lightline_buffer_show_bufnr = 0
819let g:lightline_buffer_rotate = 0
820let g:lightline_buffer_fname_mod = ':t'
821let g:lightline_buffer_excludes = ['vimfiler']
822let g:lightline_buffer_maxflen = 30
823let g:lightline_buffer_maxfextlen = 3
824let g:lightline_buffer_minflen = 16
825let g:lightline_buffer_minfextlen = 3
826let g:lightline_buffer_reservelen = 20
827
828" \ ['warnings', 'errors', 'syntastic']
829" \ 'left': [ [ 'bufferinfo' ], [ 'bufferbefore', 'buffercurrent', 'bufferafter' ], ],
830let g:lightline = {
831 \ 'tabline': {
832 \ 'left': [ [ 'servername', 'sessionname' ] ],
833 \ 'right': [ [], ['gitbranch', 'tabnumber'] ],
834 \ },
835 \ 'colorscheme': 'Tomorrow_Night',
836 \ 'separator': { 'left': "\uE0B4", 'right': "\uE0B6" },
837 \ 'subseparator': { 'left': "\uE0b1", 'right': "\uE0b3" },
838 \ 'inactive': {
839 \ 'left': [ [ 'pwd', 'relativepath'] ],
840 \ 'right': []
841 \ },
842 \ 'active': {
843 \ 'left': [ [ 'mode', 'register', 'paste' ], [ 'pwd', 'relativepath' ] , ['tagbar']],
844 \ 'right': [ [ 'lineinfo', 'percent' ], [ 'filetype', 'readonly', 'spell', 'fileencoding', 'fileformat' ] ]
845 \ },
846 \ 'component': {
847 \ 'tagbar': '%{substitute(tagbar#currenttag("%s", "", "fs"), "\(.*\)", "", "")}',
848 \ 'ycmparent': '%{substitute(execute("YcmComplete GetParent"), "\(.*\)", "", "")}',
849 \ 'filename': '%t',
850 \ 'buffer_alt': '%{expand("#:t")}',
851 \ 'servername': ' %{v:servername}',
852 \ 'sessionname': '%{v:this_session}',
853 \ 'gitbranch': ' %{fugitive#head()}',
854 \ 'tabnumber': " %{tabpagenr()}/%{tabpagenr('$')}",
855 \ 'readonly': '%{&readonly ? "" : ""}',
856 \ 'register': '%{v:register}',
857 \ 'title': '%{getwinvar(0, "quickfix_title")}',
858 \ 'pwd': '%{fnamemodify(getcwd(), ":~")}',
859 \ 'relativepath': '%{fnamemodify(expand("%"), ":.")}'
860 \ },
861 \ 'component_expand': {
862 \ 'buffercurrent': 'lightline#buffer#buffercurrent2',
863 \ 'syntastic': 'SyntasticStatuslineFlag',
864 \ },
865 \ 'component_function': {
866 \ 'bufferinfo': 'lightline#buffer#bufferinfo',
867 \ 'warnings': 'youcompleteme#GetWarningCount',
868 \ 'errors': 'youcompleteme#GetErrorCount',
869 \ },
870 \ }
871
872
873" Autocompleter: =====================================
874if has("python")
875
876 " ULTISNIPS: code snippet ============================================================================================
877 Plug 'honza/vim-snippets' " dependency of ultisnips (see below)
878 Plug 'SirVer/ultisnips' " replaces loremipsum (and many more)
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 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)
881
882 let g:UltiSnipsJumpForwardTrigger = '<Tab>'|
883 let g:UltiSnipsJumpBackwardTrigger = '<S-Tab>'|
884 "d let g:UltiSnipsJumpForwardTrigger = '<PageDown>'
885 " let g:UltiSnipsJumpBackwardTrigger = '<PageUp>'
886 "let g:UltiSnipsExpandTrigger = '<C-j>'| " Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
887 "let g:UltiSnipsJumpForwardTrigger = '<C-j>'| " \
888 "let g:UltiSnipsJumpBackwardTrigger = '<C-k>'| " \
889 "let g:UltiSnipsListSnippets = '<C-`>'| " YouCompleteMe includes those, so this isn't necessary
890 "let g:UltiSnipsListSnippets = '<leader><leader>'| " YouCompleteMe includes those, so this isn't necessary
891 """ Ultisnips
892 " let g:UltiSnipsExpandTrigger="<c-tab>"
893 " let g:UltiSnipsListSnippets="<c-s-tab>"
894
895 if has('nvim')
896 Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
897 " Use deoplete.
898 let g:deoplete#enable_at_startup = 1
899 inoremap <silent><expr> <C-Space> deoplete#mappings#manual_complete()
900
901 Plug 'Shougo/echodoc.vim'
902 let g:echodoc#enable_at_startup = 1
903
904 " Plug 'Rip-Rip/clang_complete'
905 " Plug 'tweekmonster/deoplete-clang2'
906 " Plug 'zchee/deoplete-clang'
907 " let g:deoplete#sources#clang#libclang_path = "/usr/lib/libclang.so"
908 " let g:deoplete#sources#clang#clang_header = "/usr/lib/clang/6.0.0"
909 " let g:deoplete#sources#clang#std#cpp = 'c++1z'
910 " let g:deoplete#sources#clang#clang_complete_database = "/home/max/src"
911 " Plug 'Shougo/neoinclude.vim' " makes vim slow - unfortunatelly
912
913 Plug 'autozimu/LanguageClient-neovim', {
914 \ 'branch': 'next',
915 \ 'do': 'bash install.sh',
916 \ }
917
918 let g:LanguageClient_serverCommands = {
919 \ 'cpp': ['clangd']
920 \ }
921 " Plug 'roxma/nvim-completion-manager' unmaintained python version
922 else
923 Plug 'idanarye/vim-vebugger'
924
925 " YouCompleteMe: =====================================================================================================
926 " Plug 'Valloric/MatchTagAlways' " highlights the closing tag/brace/...
927 Plug 'Valloric/YouCompleteMe', {
928 \ 'do' : 'python install.py --clang-completer',
929 \ }
930 let g:ycm_error_symbol = '✖' " insert this as an error symbol in the gutter bar/sign column
931 let g:ycm_warning_symbol = '➔' " insert this as a warning symbol in the gutter bar/sign coloumn
932
933 let g:ycm_autoclose_preview_window_after_insertion = 0
934 let g:ycm_auto_trigger = 1
935 let g:ycm_collect_identifiers_from_tags_files = 1 " Let YCM read tags from Ctags file
936 let g:ycm_confirm_extra_conf = 0 " security is overrated ;)
937
938 let g:ycm_key_list_previous_completion = ['Up']
939 let g:ycm_key_list_select_completion = ['Down']
940
941 " Plug 'vim-scripts/dbext.vim' " dependency to allow db related completions
942 " let g:ycm_server_python_interpreter = 'python3'
943 " let g:ycm_python_binary_path = '/usr/bin/python3' " the python interpreter of choice (for code checking)
944 " let g:ycm_add_preview_to_completeopt = 1 " reuse existing preview window
945 " let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword
946 " let g:ycm_complete_in_comments = 1 " Completion in comments
947 " let g:ycm_complete_in_strings = 1 " Completion in string
948 " 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!)
949 " let g:ycm_min_num_identifier_candidate_chars = 4
950 " let g:ycm_max_num_identifier_candidates = 10
951 " let g:ycm_max_num_candidates = 50
952 " let g:ycm_use_ultisnips_completer = 1 " Default 1, just ensure
953 " let g:ycm_key_list_select_completion = ['<Down>']
954 " let g:ycm_key_list_previous_completion = ['<Up>']
955 " let g:ycm_global_ycm_extra_conf = '.ycm_extra_conf.py'
956 " let g:ycm_semantic_triggers = { 'c': [ 're!.' ] }
957 " " let g:ycm_disable_for_files_larger_than_kb = 16384 " we have faaast computers, don't we?
958 " let g:ycm_show_diagnostics_ui = 0
959 " " disable <tab>-key for YCM so that it can be used with ultisnips
960 " let g:ycm_key_list_select_completion=[]
961 " let g:ycm_key_list_previous_completion=[]
962 endif
963
964
965 " SYNTASTIC: =========================================================================================================
966 if has('nvim')
967 Plug 'w0rp/ale'
968 let g:ale_set_highlights = 0
969 highlight! link ALEWarningSign FoldColumn
970 let g:ale_sign_error = ''
971 let g:ale_sign_style_error = ''
972 let g:ale_sign_info = ''
973 let g:ale_sign_warning = ''
974 else
975 Plug 'scrooloose/syntastic'
976 set statusline+=%#warningmsg#
977 set statusline+=%{SyntasticStatuslineFlag()}
978 let g:LatexBox_latexmk_preview_continuously = 1
979 let g:LatexBox_viewer = "evince"
980 let g:syntastic_always_populate_loc_list = 1
981 let g:syntastic_auto_loc_list = 0
982 let g:syntastic_check_on_open = 1
983 let g:syntastic_check_on_wq = 0
984 " let g:syntastic_quiet_messages = {"type":"style"}
985 "
986 " E221: multiple spaces before Operator
987 let g:syntastic_python_flake8_args = '--max-complexity=10 --max-line-length=120 --exclude venv --doctests --exit-zero --ignore=E221'
988 " filter ( = do not display) style/formatting errors and warnings
989 let g:syntastic_error_symbol = '✖'
990 let g:syntastic_style_error_symbol = '✗'
991 let g:syntastic_warning_symbol = '➔'
992 let g:syntastic_style_warning_symbol = '≈'
993 endif
994
995 " JEDI: ==============================================================================================================
996 Plug 'davidhalter/jedi-vim' " jedi gets used to display python function signatures
997 let g:jedi#completions_enabled = 0 " we do not need completions, because we have YouCompleteMe
998 let g:jedi#show_call_signatures = 1 " which sadly does not support signatures like jedi
999 let g:jedi#show_call_signatures_delay = 0
1000 let g:jedi#auto_vim_configure = 0
1001 let g:pymode_rope = 0 " https://github.com/davidhalter/jedi-vim/issues/163
1002 " autocmd FileType python jedi.preload_module('os', 'sys', 'math')
1003 " let g:pymode_options_max_line_length = 120
1004 " let g:syntastic_python_flake8_args='--ignore=F821,E302,E501,E241,E301'
1005
1006endif " has("python")
1007
1008"=======================================================================================================================
1009" TESTING: | " plugins which I am currently trying...
1010"=======================================================================================================================
1011" Plug 'rhysd/vim-clang-format' | unnecessary, because we can just :pyf /usr/share/clang/clang-format.py
1012Plug 'kana/vim-operator-user' " dependency, which allows overriding the = operator for indentation
1013
1014" TODO: check if this is unrequired, when set equalprog is set to that py file
1015autocmd FileType c,cpp,objc map <buffer> = :pyf /usr/share/clang/clang-format.py<CR>
1016
1017" let g:clang_format#detect_style_file = 1
1018" autocmd FileType c,cpp,objc map <buffer> = <Plug>(operator-clang-format)
1019
1020" Plug 'tpope/vim-characterize' | " normal mode: make ga show character names of Unicode chars (ga shows hex and dec values)
1021" Plug 'rkitover/vimpager'
1022" found this command instead (use as PAGER):
1023" man -P 'nvim -R -u NORC -c":%!col -b" -c":set buftype=nowrite filetype=man" -' ls
1024
1025command BuffersToArg :exec ':args '.join(map(range(0, bufnr('$')), 'fnameescape(fnamemodify(bufname(v:val), ":."))'))
1026command BufToArg :argadd %:.
1027
1028"=======================================================================================================================
1029call plug#end() | " all plugins are getting loaded on this line, don't remove!
1030
1031" ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
1032" END: LOADING PLUGINS
1033" ======================================================================================================================
1034
1035" Deprecated with this configuration, but still useful when deactivating some Plugins
1036" NETRW: obsolete with NERDTree
1037let g:netrw_alto = 0 | " open files on the right
1038let g:netrw_altv = 1 | " open files on the right
1039let g:netrw_banner = 0 | " display help messages?
1040let g:netrw_browse_split = 4 | " 4=open in previous window
1041let g:netrw_fastbrowse = 2 | " manually refresh direcory list (avoids display errors)
1042let g:netrw_hide = 1 | " show not-hidden files only
1043let g:netrw_keepdir = 0
1044let g:netrw_list_hide = '^\..*' | " Explore mode: hide files starting with dot
1045let g:netrw_liststyle = 3 | " 3=tree
1046let g:netrw_preview = 0 | "
1047let g:netrw_winsize = 20 | " window size in percent
1048
1049" ======================================================================================================================
1050" COLORSCHEME:
1051" ======================================================================================================================
1052
1053function! ExtendColorTheme()
1054 filetype on
1055 filetype plugin on
1056 filetype indent on
1057
1058 syntax on | " enable syntax highlighting
1059 syntax sync minlines=60 | " how many preceding lines will be parsed? (has performance impact)
1060
1061 " use the default terminal background color as background (allows transparency)
1062 " highlight! Normal guibg=NONE ctermbg=NONE
1063 " highlight! NonText guibg=NONE guifg=black ctermbg=NONE ctermfg=black
1064
1065 " make the ~ (tilde) indicator invisible, which usually marks the EOF
1066 highlight! link EndOfBuffer Ignore
1067
1068 highlight! CursorLineNr cterm=inverse | " ctermbg=black ctermfg=NONE
1069 highlight! Pmenu ctermbg=LightYellow ctermfg=DarkGrey
1070 highlight! PmenuSel ctermbg=blue ctermfg=LightYellow cterm=bold
1071
1072 highlight! link PmenuSbar Pmenu
1073 highlight! PmenuThumb cterm=inverse
1074 highlight! MoreMsg cterm=inverse
1075 highlight! link Folded LineNr
1076 highlight! Cursor guibg=#729fcf ctermbg=yellow
1077 highlight! link VertSplit LineNr
1078 " highlight! SpellBad ctermbg=none
1079 highlight! SpecialKey ctermfg=19
1080 highlight! WhiteSpace ctermfg=19
1081
1082 highlight! link TabLine LineNr
1083 highlight! TabLineSel ctermbg=blue ctermfg=black
1084 highlight! link TabLineFill LineNr
1085 highlight! Search ctermbg=LightYellow ctermfg=black guibg=#fefd86 guifg=#222222
1086 highlight! link WildMenu Search
1087
1088 " generic, which should exist but don't
1089 highlight! Bold cterm=bold gui=bold
1090 highlight! Italic cterm=italic gui=italic
1091 highlight! Underline cterm=underline gui=underline
1092 highlight! BoldUnderline cterm=bold,underline gui=bold,underline
1093 highlight! BoldItalic cterm=Bold,Italic gui=Bold,Italic
1094
1095 " make tab stop (see listchars) less disturbing...
1096 highlight! link SpecialKey NonText
1097
1098 " highlight! link LightlineMiddle_tabline ColorColumn
1099 " highlight! link LightlineLeft_tabline_1 ColorColumn
1100 " highlight! link LightlineLeft_tabline_0_1 ColorColumn
1101
1102 highlight! Todo guibg=#ffffaa guifg=#000000 gui=bold term=bold
1103 highlight! cStatement guifg=red gui=bold term=bold
1104
1105 highlight! link Convention Error
1106
1107 let g:status_fg=synIDattr(hlID('Cursor'), 'fg#')
1108 let g:status_bg=synIDattr(hlID('Cursor'), 'bg#')
1109 let g:status_sel=synIDattr(hlID('StatusLine'), 'fg#')
1110
1111 execute 'highlight! StatusLine'
1112 \ .' guibg='.g:status_sel
1113 \ .' guifg=NONE'
1114
1115 execute 'highlight! User1 guibg='.g:status_bg
1116 execute 'highlight! User1 guifg='.g:status_fg
1117
1118 execute 'highlight! User2 guibg='.g:status_sel
1119 execute 'highlight! User2 guifg='.g:status_bg
1120
1121
1122
1123 " autocmd InsertLeave * call matchadd('Conceal', ' \+$', -1, 101, { 'conceal': '⟶' })
1124 autocmd InsertEnter * silent! call matchdelete(101)
1125 autocmd InsertLeave * call matchadd('Convention', ' \+$', -1, 101, { 'conceal': '⟶' })
1126
1127 " Show trailing whitepace and spaces before a tab as part of the syntax highlighting
1128 " autocmd BufEnter,InsertLeave * syntax match Convention /\s\+$\| \+\ze\t/ containedin=ALL
1129 " autocmd Syntax * syntax match Convention /\s\+$\| \+\ze\t/ containedin=ALL
1130 " autocmd BufEnter,BufWritePost * syntax match Convention /\s\+$\| \+\ze\t/ containedin=ALL
1131 " autocmd InsertEnter * syntax clear Convention
1132 " autocmd BufEnter,InsertLeave * execute ':syntax match Convention /\%>'.&textwidth.'v./ containedin=ALL'
1133
1134 autocmd InsertEnter * set colorcolumn=80,120
1135 autocmd InsertLeave * set colorcolumn&
1136 " set colorcolumn= | " not used, because we have a :match directive for textwidth
1137 "
1138" if argc() == 0
1139 " rv
1140 " autocmd VimEnter * split +bro\ ol
1141" endif
1142"
1143
1144endfunction
1145autocmd! ColorScheme * call ExtendColorTheme()
1146
1147
1148set termguicolors | " When on, uses highlight-guifg and highlight-guibg attributes in the terminal (=24bit color) incompatible with nvim
1149" set t_ut=
1150
1151if filereadable(expand("~/.vimrc_background")) && filereadable(expand("~/.config/base16-shell/colortest"))
1152 let g:base16_shell_path="~/.config/base16-shell/scripts"
1153 let base16colorspace=256
1154 let syntax_cmd="skip" " vim internal, use base16 and no default colors
1155 set background=dark
1156 source ~/.vimrc_background
1157else
1158 let g:PaperColor_Theme_Options = {
1159 \ 'theme': {
1160 \ 'default': {
1161 \ 'transparent_background': 1
1162 \ }
1163 \ }
1164 \ }
1165 set background=dark
1166 colorscheme PaperColor
1167endif
1168
1169" ======================================================================================================================
1170" CONVENIENCE:
1171" ======================================================================================================================
1172if empty(argv())
1173
1174 " autocmd VimEnter * call setloclist(0, filter(map(copy(v:oldfiles), {_, p->{'filename': expand(get(split(p, "'"), 0))}}), { val -> echo val}))
1175
1176 " from the list of recent files: make absolute paths, filter out files not
1177 " contained in cwd and finally filter out directories and non-files...
1178 autocmd StdinReadPre * let s:std_in=1
1179 autocmd VimEnter * if !exists("s:std_in") | call setqflist(map(filter(filter(
1180 \ map(copy(v:oldfiles), {_, p->expand(p)}), 'v:val =~ "'.getcwd().'"'),
1181 \ 'filereadable(v:val)'), {_, p->{'filename': fnamemodify(p, ':.')}})) | copen | only
1182endif
1183
1184command Vimls
1185 \ call setloclist(0, map(getbufinfo({'buflisted':1}),
1186 \ "{'bufnr': v:val.bufnr,
1187 \ 'lnum': v:val.lnum,
1188 \ 'text': '='.printf('%*s, % 3d: %s [%s]', winwidth(0) / 2, '', v:val.bufnr, v:val.name, getbufvar(v:val.bufnr, '&buftype')),
1189 \ 'pattern': 'not loaded'}
1190 \ "))
1191
1192command Ctoggle
1193 \ if(get(getqflist({'winid':1}), 'winid') == win_getid())|cclose|else|botright copen|endif
1194command Ltoggle
1195 \ if(get(getloclist(0, {'winid':1}), 'winid') == win_getid())|lclose|else|lopen|endif
1196
1197
1198
1199" nnoremap <silent> <ESC> :lclose<CR> " brings vim into REPLACE mode (R)
1200nnoremap <silent> <F7> :Ltoggle<CR>
1201nnoremap <silent> <F8> :Ctoggle<CR>
1202nnoremap <silent> <F12> :Vimls<CR>:Ltoggle<CR>
1203
1204" exec current line as a command, insert output of command (from: https://youtu.be/MquaityA1SM?t=35m45s)
1205nnoremap Q !!$SHELL<CR>
1206
1207
1208" ======================================================================================================================
1209" TESTING:
1210" ======================================================================================================================
1211" avoids openin an empty buffer when restoring bufferlist from viminfo...
1212" if argc() == 0
1213" silent autocmd VimEnter * nested :silent bun
1214" endif
1215
1216autocmd VimEnter,WinEnter * exec ':set scrolljump='.winheight(0)/2
1217
1218" display highlight group under the cursor
1219map <leader>h :echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')<CR>
1220
1221" call setqflist( map(systemlist("git show --name-only --pretty=''"), {_, p->{'filename': fnamemodify(p, ':.')}}))
diff --git a/vimrc-full b/vimrc-full
index 3b9cdd6..a4fb101 100644
--- a/vimrc-full
+++ b/vimrc-full
@@ -746,22 +746,7 @@ nnoremap <F9> :TagbarToggle<CR>| " bind TagBar to hotkey F9
746set noshowmode | " mode will be shown twice, in lightline and below, so we want to deactivate one 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 747set laststatus=2 | " required by AirLine and Lightline, without status line does not appear until a window split
748 748
749set statusline= 749" Plug 'itchyny/lightline.vim'
750set statusline+=%{(&modified?nr2char(0xF0C7):'')}
751set statusline+=%{(&readonly\ ?\ ''\ :\ '')}
752set statusline+=%{fnamemodify(getcwd(),':~')}
753set statusline+=%{nr2char(0x20)}
754set statusline+=%{nr2char(0xE0B1)}
755set statusline+=%{nr2char(0x20)}
756set statusline+=%f
757set statusline+=%*%=
758set statusline+=%l:%c(%p%%)
759" set statusline+=%t%m
760" set statusline+=%{TagInStatusLine()}
761" set statusline+=%#warningmsg#
762" set statusline+=%{SyntasticStatuslineFlag()}
763
764Plug 'itchyny/lightline.vim'
765 750
766" lightline-buffer ui settings 751" lightline-buffer ui settings
767" replace these symbols with ASCII characters if your environment does not support unicode 752" replace these symbols with ASCII characters if your environment does not support unicode
@@ -933,8 +918,8 @@ if has("python")
933 let g:ale_sign_warning = '' 918 let g:ale_sign_warning = ''
934 else 919 else
935 Plug 'scrooloose/syntastic' 920 Plug 'scrooloose/syntastic'
936 set statusline+=%#warningmsg# 921 " set statusline+=%#warningmsg#
937 set statusline+=%{SyntasticStatuslineFlag()} 922 " set statusline+=%{SyntasticStatuslineFlag()}
938 let g:LatexBox_latexmk_preview_continuously = 1 923 let g:LatexBox_latexmk_preview_continuously = 1
939 let g:LatexBox_viewer = "evince" 924 let g:LatexBox_viewer = "evince"
940 let g:syntastic_always_populate_loc_list = 1 925 let g:syntastic_always_populate_loc_list = 1
@@ -1011,6 +996,28 @@ let g:netrw_winsize = 20 | " window size in percent
1011" ====================================================================================================================== 996" ======================================================================================================================
1012 997
1013function! ExtendColorTheme() 998function! ExtendColorTheme()
999 " let g:status_fg=synIDattr(hlID('Cursor'), 'fg#')
1000 " let g:status_bg=synIDattr(hlID('Cursor'), 'bg#')
1001 " let g:status_sel=synIDattr(hlID('Text'), 'fg#')
1002 " let g:status_sel='#ffffff'
1003 let g:status_fg='#00aa00'
1004 let g:status_bg='#000000'
1005 let g:status_sel='#ffff00'
1006
1007 " execute 'highlight! StatusLine'
1008 " \ .' guibg=NONE'
1009 " \ .' guifg='.g:status_bg
1010 " \ .' gui=inverse'
1011
1012 " " execute 'highlight! User1 gui=NONE'
1013 " execute 'highlight! User1 guibg='.g:status_sel
1014 " execute 'highlight! User1 guifg='.g:status_fg
1015
1016 " execute 'highlight! User2 gui=NONE'
1017 " execute 'highlight! User2 guibg='.g:status_sel
1018 " execute 'highlight! User2 guifg=NONE'
1019
1020
1014 filetype on 1021 filetype on
1015 filetype plugin on 1022 filetype plugin on
1016 filetype indent on 1023 filetype indent on
@@ -1033,7 +1040,7 @@ function! ExtendColorTheme()
1033 highlight! PmenuThumb cterm=inverse 1040 highlight! PmenuThumb cterm=inverse
1034 highlight! MoreMsg cterm=inverse 1041 highlight! MoreMsg cterm=inverse
1035 highlight! link Folded LineNr 1042 highlight! link Folded LineNr
1036 highlight! Cursor guibg=#729fcf ctermbg=yellow 1043 " highlight! Cursor guibg=#729fcf ctermbg=yellow
1037 highlight! link VertSplit LineNr 1044 highlight! link VertSplit LineNr
1038 " highlight! SpellBad ctermbg=none 1045 " highlight! SpellBad ctermbg=none
1039 highlight! SpecialKey ctermfg=19 1046 highlight! SpecialKey ctermfg=19
@@ -1082,9 +1089,7 @@ function! ExtendColorTheme()
1082" if argc() == 0 1089" if argc() == 0
1083 " rv 1090 " rv
1084 " autocmd VimEnter * split +bro\ ol 1091 " autocmd VimEnter * split +bro\ ol
1085" endif 1092 " endif
1086"
1087
1088endfunction 1093endfunction
1089autocmd! ColorScheme * call ExtendColorTheme() 1094autocmd! ColorScheme * call ExtendColorTheme()
1090 1095
@@ -1092,24 +1097,6 @@ autocmd! ColorScheme * call ExtendColorTheme()
1092set termguicolors | " When on, uses highlight-guifg and highlight-guibg attributes in the terminal (=24bit color) incompatible with nvim 1097set termguicolors | " When on, uses highlight-guifg and highlight-guibg attributes in the terminal (=24bit color) incompatible with nvim
1093" set t_ut= 1098" set t_ut=
1094 1099
1095if filereadable(expand("~/.vimrc_background")) && filereadable(expand("~/.config/base16-shell/colortest"))
1096 let g:base16_shell_path="~/.config/base16-shell/scripts"
1097 let base16colorspace=256
1098 let syntax_cmd="skip" " vim internal, use base16 and no default colors
1099 set background=dark
1100 source ~/.vimrc_background
1101else
1102 let g:PaperColor_Theme_Options = {
1103 \ 'theme': {
1104 \ 'default': {
1105 \ 'transparent_background': 1
1106 \ }
1107 \ }
1108 \ }
1109 set background=dark
1110 colorscheme PaperColor
1111endif
1112
1113" ====================================================================================================================== 1100" ======================================================================================================================
1114" CONVENIENCE: 1101" CONVENIENCE:
1115" ====================================================================================================================== 1102" ======================================================================================================================
@@ -1163,3 +1150,112 @@ autocmd VimEnter,WinEnter * exec ':set scrolljump='.winheight(0)/2
1163map <leader>h :echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')<CR> 1150map <leader>h :echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')<CR>
1164 1151
1165" call setqflist( map(systemlist("git show --name-only --pretty=''"), {_, p->{'filename': fnamemodify(p, ':.')}})) 1152" call setqflist( map(systemlist("git show --name-only --pretty=''"), {_, p->{'filename': fnamemodify(p, ':.')}}))
1153"
1154if filereadable(expand("~/.vimrc_background")) && filereadable(expand("~/.config/base16-shell/colortest"))
1155 let g:base16_shell_path="~/.config/base16-shell/scripts"
1156 let base16colorspace=256
1157 let syntax_cmd="skip" " vim internal, use base16 and no default colors
1158 set background=dark
1159 source ~/.vimrc_background
1160else
1161 let g:PaperColor_Theme_Options = {
1162 \ 'theme': {
1163 \ 'default': {
1164 \ 'transparent_background': 1
1165 \ }
1166 \ }
1167 \ }
1168 set background=dark
1169 colorscheme PaperColor
1170endif
1171
1172augroup status
1173 function! CreateInvertGroup(highlight_group)
1174 if(synIDattr(hlID(a:highlight_group), "reverse")==1)
1175 let w:color=synIDattr(hlID(a:highlight_group), "fg#")
1176 else
1177 let w:color=synIDattr(hlID(a:highlight_group), "bg#")
1178 endif
1179
1180 let l:retval=a:highlight_group.'_invert'
1181 if(exists('w:color') && w:color == '')
1182 let w:color = 'NONE'
1183 endif
1184 exec 'highlight '.retval.' gui=NONE guifg='.w:color
1185 return l:retval
1186 endfunction
1187
1188 function! UpdateStatus(highlight_group)
1189 let l:invert_group = CreateInvertGroup(a:highlight_group)
1190 return
1191 \ "%#StatusLineHighlight#" .
1192 \ "%#".a:highlight_group."#" .
1193 \ "%{(&readonly\ ?\ '\ \ \ '\ :\ '')}" .
1194 \ "%{(&modified\ ?\ nr2char(0xF0C7).'\ '\ :\ '')}" .
1195 \ "%(%w%h%q\ %-8{mode(1)}%)" .
1196 \ "%{nr2char(0xe621)}" .
1197 \ "%(\ %{fnamemodify(getcwd(),\ ':~')}\ %)" .
1198 \ "%{nr2char(0xf44a)}" .
1199 \ "%(\ %f\ %)" .
1200 \ "%#".l:invert_group."#" .
1201 \ "%{nr2char(0xE0B4)\ }" .
1202 \ '' .
1203 \ "%=" .
1204 \ '' .
1205 \ "%#".l:invert_group."#" .
1206 \ "%{nr2char(0xE0B6)}" .
1207 \ "%#".a:highlight_group."#" .
1208 \ "%1(%)" .
1209 \ "%{\ &filetype}" .
1210 \ "%(\ %{nr2char(0xe621)}\ %)" .
1211 \ "%{&fileencoding}" .
1212 \ "%(\ %{nr2char(0xe621)}\ %)" .
1213 \ "%{&fileformat}" .
1214 \ "%(\ %{nr2char(0xe621)}\ %)" .
1215 \ "%4l:%-4c" .
1216 \ "%-3p%%" .
1217 \ '' " end ^
1218 endfunction
1219
1220 function! UpdateTabline(highlight_group)
1221 let l:invert_group = CreateInvertGroup(a:highlight_group)
1222 return
1223 \ "%#".a:highlight_group."#" .
1224 \ "%3(\ %)" .
1225 \ "%{nr2char(0xe621)}" .
1226 \ "%(%{v:servername}\ %{v:this_session}%)" .
1227 \ "%#".l:invert_group."#" .
1228 \ "%{nr2char(0xE0B4)\ }" .
1229 \ '' .
1230 \ "%=" .
1231 \ '' .
1232 \ "%#".l:invert_group."#" .
1233 \ "%{nr2char(0xE0B6)}" .
1234 \ "%#".a:highlight_group."#" .
1235 \ "%(\ \ %{fugitive#head()}\ %)" .
1236 \ "%{nr2char(0xe621)}" .
1237 \ "%(\ \ %{tabpagenr()}/%{tabpagenr('$')}\ %)" .
1238 \ "%##" .
1239 \ "" " end ^
1240 endfunction
1241
1242 let g:group_active = "StatusLine"
1243 let g:group_inactive = "StatusLineNC"
1244 let g:group_tabline = "TabLineSel"
1245
1246 function ApplyColorScheme()
1247 " set up statusline, global and current window individually
1248 set statusline=%!UpdateStatus(g:group_inactive)
1249 setlocal statusline=%!UpdateStatus(g:group_active)
1250 " set up the tabline (match colors)
1251 set tabline=%!UpdateTabline(g:group_tabline)
1252 endfunction
1253 " apply colors from the loaded colorscheme...
1254 call ApplyColorScheme()
1255
1256 " when changing the colorscheme also apply new colors to the statusbar...
1257 autocmd ColorScheme * call ApplyColorScheme()
1258
1259 autocmd WinEnter * setlocal statusline=%!UpdateStatus(g:group_active)
1260 autocmd WinLeave * setlocal statusline<
1261augroup END
..