diff options
author | Max Christian Pohle | 2017-10-15 19:31:28 +0200 |
---|---|---|
committer | Max Christian Pohle | 2017-10-15 19:31:28 +0200 |
commit | 3377b86a73ce6f13bc43dac24a8bdf80be5f4cc0 (patch) | |
tree | 8c7b6801e5ef14b3f10cd893aac179744638dcb4 /vimrc-full | |
parent | 307d2ef4d4d0174f749388fdd6396d8bc64d0f52 (diff) | |
download | vim-3377b86a73ce6f13bc43dac24a8bdf80be5f4cc0.tar.bz2 vim-3377b86a73ce6f13bc43dac24a8bdf80be5f4cc0.zip |
Major refactoring, added many menues and comfort features
Diffstat (limited to 'vimrc-full')
-rw-r--r-- | vimrc-full | 412 |
1 files changed, 252 insertions, 160 deletions
@@ -9,9 +9,12 @@ | |||
9 | "======================================================================================================================= | 9 | "======================================================================================================================= |
10 | " GENERAL: | 10 | " GENERAL: |
11 | "======================================================================================================================= | 11 | "======================================================================================================================= |
12 | set textwidth=120 | " better done with modeline | 12 | set exrc | " enable exrc, a specific .exrc per project, which can contain usual .vimrc commands |
13 | set ts=4 sts=4 sw=4 expandtab | " better done with a modeline | 13 | set textwidth=120 | " better done with modeline or local exrc |
14 | set redrawtime=1000 | " Timeout in milliseconds for redrawing the display / CTRL+L to retry | 14 | set ts=4 sts=4 sw=4 expandtab | " better done with a modeline or local exrc |
15 | set virtualedit=all | " virtual edit should be default behaviour, because I don't see any reason against | ||
16 | set number norelativenumber | " turn line numbers on/off (performance decreases when they are shown) | ||
17 | set ignorecase smartcase hlsearch | " search with ignorecase by default, but use case sensitive search when one captical char is contained and highlight while typing (even though its slower) | ||
15 | 18 | ||
16 | "======================================================================================================================= | 19 | "======================================================================================================================= |
17 | " SHELL | 20 | " SHELL |
@@ -89,42 +92,51 @@ if has('cscope') " compiled with cscope support? | |||
89 | endif | 92 | endif |
90 | 93 | ||
91 | if has('menu') | 94 | if has('menu') |
92 | menu &Cscope.create\ and\ add\ database | 95 | menu &:cscope.find.c\ symbol |
93 | \ :execute '!find -regex ".*\.\(c\\|h\\|cpp\\|cxx\\|hh\\|hpp\\|hxx\)$" <bar> cscope -i- -b -q'<CR>:cscope kill -1<CR>:cscope add .<CR> | 96 | \<tab>s |
94 | menu &Cscope.-Sep- | 97 | \ :cscope find s <cword><:cR> |
95 | \ : | 98 | menu &:cscope.find.definition |
96 | menu &Cscope.find.C\ symbol | 99 | \<tab>g |
97 | \ :cscope find s <cword><CR> | 100 | \ :cscope find g <cword><:cR> |
98 | menu &Cscope.find.definition | 101 | menu &:cscope.find.functions\ called\ by\ this |
99 | \ :cscope find g <cword><CR> | 102 | \<tab>d |
100 | menu &Cscope.find.functions\ called\ by\ this | 103 | \ :cscope find d <cword><:cR> |
101 | \ :cscope find d <cword><CR> | 104 | menu &:cscope.find.functions\ calling\ this |
102 | menu &Cscope.find.functions\ calling\ this | 105 | \<tab>c |
103 | \ :cscope find c <cword><CR> | 106 | \ :cscope find c <cword><:cR> |
104 | menu &Cscope.find.text\ string | 107 | menu &:cscope.find.text\ string |
105 | \ :cscope find t <cword><CR> | 108 | \<tab>t |
106 | menu &Cscope.find.egrep\ pattern | 109 | \ :cscope find t <cword><:cR> |
107 | \ :cscope find e <cword><CR> | 110 | menu &:cscope.find.egrep\ pattern |
108 | menu &Cscope.find.this\ file | 111 | \<tab>e |
109 | \ :cscope find f <cword><CR> | 112 | \ :cscope find e <cword><:cR> |
110 | menu &Cscope.find.files\ including\ this\ file | 113 | menu &:cscope.find.this\ file |
111 | \ :cscope find i <cword><CR> | 114 | \<tab>f |
112 | menu &Cscope.find.places\ where\ this\ symbol\ is\ assigned\ a\ value | 115 | \ :cscope find f <cword><:cR> |
113 | \ :cscope find a <cword><CR> | 116 | menu &:cscope.find.files\ including\ this\ file |
114 | menu &Cscope.-Sep- | 117 | \<tab>i |
115 | \ : | 118 | \ :cscope find i <cword><:cR> |
116 | menu &Cscope.add | 119 | menu &:cscope.find.places\ where\ this\ symbol\ is\ assigned\ a\ value |
117 | \ :cscope add .<CR> | 120 | \<tab>a |
118 | menu &Cscope.show | 121 | \ :cscope find a <cword><:cR> |
119 | \ :cscope show<CR> | 122 | menu &:cscope.-Sep1- |
120 | menu &Cscope.reset | 123 | \ : |
121 | \ :cscope reset<CR> | 124 | menu &:cscope.create\ and\ add\ database |
125 | \ :cscope kill -1<CR>:execute '!find -regex ".*\.\(c\\|h\\|cpp\\|cxx\\|hh\\|hpp\\|hxx\)$" <bar> cscope -i- -b -q'<CR>:cscope add .<CR> | ||
126 | menu &:cscope.-Sep2- | ||
127 | \ : | ||
128 | menu &:cscope.add\ \. | ||
129 | \ :cscope add .<CR> | ||
130 | menu &:cscope.show | ||
131 | \ :cscope show<CR> | ||
132 | menu &:cscope.reset | ||
133 | \ :cscope reset<CR> | ||
122 | endif | 134 | endif |
123 | endif | 135 | endif |
124 | 136 | ||
125 | " ======================================================================================================================= | 137 | " ====================================================================================================================== |
126 | " GUI_VERSION | 138 | " GUI_VERSION |
127 | " ======================================================================================================================= | 139 | " ====================================================================================================================== |
128 | if has("gui_running") | 140 | if has("gui_running") |
129 | set guicursor=a:block-blinkon100 | 141 | set guicursor=a:block-blinkon100 |
130 | set browsedir=buffer | 142 | set browsedir=buffer |
@@ -145,82 +157,91 @@ if has("gui_running") | |||
145 | 157 | ||
146 | " its possible to define alternative fonts (order matters) | 158 | " its possible to define alternative fonts (order matters) |
147 | set guifont= | 159 | set guifont= |
148 | set guifont+=Dejavu\ Sans\ Mono\ for\ Powerline\ Semibold | 160 | set guifont+=Source\ Code\ Pro\ for\ Powerline\ SemiBold\ 10 |
149 | set guifont+=RobotoMono\ Nerd\ Font\ Medium\ 10 | ||
150 | set guifont+=LiterationMono\ Nerd\ Font\ Mono\ 10 | 161 | set guifont+=LiterationMono\ Nerd\ Font\ Mono\ 10 |
162 | set guifont+=RobotoMono\ Nerd\ Font\ Medium\ 10 | ||
151 | set guifont+=Source\ Code\ Pro\ Semi-Bold\ 10 | 163 | set guifont+=Source\ Code\ Pro\ Semi-Bold\ 10 |
152 | set guifont+=Source\ Code\ Pro\ for\ Powerline\ SemiBold\ 10 | 164 | set guifont+=Dejavu\ Sans\ Mono\ for\ Powerline\ Semibold |
153 | set guifont+=Droid\ Sans\ Mono\ for\ Powerline\ 10 | 165 | set guifont+=Droid\ Sans\ Mono\ for\ Powerline\ 10 |
154 | set guifont+=Meslo\ LG\ M\ for\ Powerline\ 10 | 166 | set guifont+=Meslo\ LG\ M\ for\ Powerline\ 10 |
167 | |||
168 | " like in the terminal: use ctrl-shift-v for paste in vim's command editor | ||
169 | cnoremap <c-s-v> <c-r>* | ||
155 | endif | 170 | endif |
156 | 171 | ||
157 | " ======================================================================================================================= | 172 | " ====================================================================================================================== |
158 | " SETTINGS: | 173 | " SETTINGS: |
159 | " ======================================================================================================================= | 174 | " ====================================================================================================================== |
160 | set noautochdir | " When on, Vim will change the current working directory | ||
161 | set breakindent | " Every wrapped line will continue visually indented | 175 | set breakindent | " Every wrapped line will continue visually indented |
162 | set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well) | 176 | set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well) |
163 | set cmdheight=2 | " sets the command line's height | ||
164 | set complete+=d | " scan current and included files for defined name or macro | ||
165 | set complete+=i | " scan current and included files for completions | ||
166 | set colorcolumn= | " not used, because we have a :match directive for textwidth | ||
167 | set concealcursor=nc | " limits the display of concealed text to normal and command mode | 177 | set concealcursor=nc | " limits the display of concealed text to normal and command mode |
168 | set conceallevel=2 | " replace escaped chars by their utf-8 representation (useful for LaTeX) | 178 | set conceallevel=2 | " replace escaped chars by their utf-8 representation (useful for LaTeX) |
169 | set confirm | " asks 'do you want to save?' | 179 | set confirm | " asks 'do you want to save?' |
170 | set cpoptions+=P | " makes :w filename set the current buffer to filename | 180 | set cpoptions+=P | " makes :w filename set the current buffer to filename |
171 | set hidden | " allows switiching buffers even if the current buffer contains changes (displays +) | 181 | set hidden | " allows switiching buffers even if the current buffer contains changes (displays +) |
172 | set hlsearch | " highlights all search matches (not as performant!) | ||
173 | set ignorecase smartcase | " search with ignorecase by default, but use case sensitive search when one captical char is contained | ||
174 | set lazyredraw | " disables redraw during macro exectution (improves performance) | ||
175 | set linebreak | " wrap long lines at char 'breakat', not inside words | 182 | set linebreak | " wrap long lines at char 'breakat', not inside words |
176 | set mouse=n | " allow mouse in normal mode only, so one can use the terminals c&p feature in insert mode | ||
177 | set mousemodel=popup | " only in gvim: right click opens a popup-menu | 183 | set mousemodel=popup | " only in gvim: right click opens a popup-menu |
178 | set nocursorcolumn | " turn visual cursor column off (improves performance) | 184 | set mouse=n | " allow mouse in normal mode only, so one can use the terminals c&p feature in insert mode |
179 | set nrformats+=alpha | " allows CTRL-A & CTRL-X to increment and decrement letters, not just numbers | 185 | set noautochdir | " When on, Vim will change the current working directory |
180 | set nofoldenable | " disable folding, because we have zi to toggle foldenable :) | ||
181 | set exrc | " enable exrc, a specific .exrc per project, which can contain usual .vimrc commands | ||
182 | set foldmethod=syntax | " foldlevel: syntax, indent, manual | ||
183 | set foldcolumn=0 | " I think I don't need this second indicator | ||
184 | set foldclose=all | " automatically fold, when the cursor leaves the folded area | ||
185 | set foldopen=block,hor,search | " when do we unfold? | ||
186 | set foldtext=Foldtext() | " | ||
187 | set foldnestmax=1 | " top level folding only | ||
188 | set norelativenumber | " relative line numbers can speed up navigation, but I could not get used to it till now | ||
189 | set noshowmode | " because we are using some powerline derivat | ||
190 | set nostartofline | " when scrolling: do not move the cursor to column 1 | 186 | set nostartofline | " when scrolling: do not move the cursor to column 1 |
191 | set notimeout ttimeout | " improves performance but is known to cause problems on slow terminals | ||
192 | set ttimeoutlen=50 | " set esc key timeout in ms- | ||
193 | set nowrap | " but do not (by default) wrap long lines around | 187 | set nowrap | " but do not (by default) wrap long lines around |
194 | set number | " turn line numbers on/off (performance decreases when they are shown) | 188 | set nrformats+=alpha | " allows CTRL-A & CTRL-X to increment and decrement letters, not just numbers |
195 | set pumheight=8 | " Determines the maximum number of items to show in the popup menu for | ||
196 | set path+=** | " allow recursive searches for files | 189 | set path+=** | " allow recursive searches for files |
190 | set pumheight=8 | " Determines the maximum number of items to show in the popup menu for | ||
197 | set scrolljump=5 | " how many lines get scrolled into view when cursor reaches the screens edge | 191 | set scrolljump=5 | " how many lines get scrolled into view when cursor reaches the screens edge |
198 | set splitbelow | " open new windows below the current one (i find that more intuitive) | 192 | set scrolloff=0 | " keeps cursor centered |
199 | set shiftround | " indent/unindent snaps to multiple of shiftwidths | 193 | set shiftround | " indent/unindent snaps to multiple of shiftwidths |
200 | set shortmess+=I | " don't give the intro message when starting Vim |:intro|. | 194 | set writedelay=0 |
201 | set showcmd | " essential: show keys of combined commands in the lower right corner (BUT SLOW, makes cursor flickering) | 195 | |
196 | " display and performance | ||
197 | set lazyredraw | " disables redraw during macro exectution (improves performance) | ||
198 | set cmdheight=2 | " sets the command line's height | ||
202 | set signcolumn=yes | " auto=auto hide, yes=always, no=never show the column with error indicators | 199 | set signcolumn=yes | " auto=auto hide, yes=always, no=never show the column with error indicators |
203 | set showtabline=2 | " 0: never, 1: only if there are at least two tabs, 2:always | 200 | set nocursorcolumn | " turn visual cursor column off (improves performance) |
204 | set winwidth=30 | " keep NERDTreeWindow at least this size | ||
205 | set winminwidth=0 | " (and all other windows, so TODO: watch out) | ||
206 | set tags+=../tags | ||
207 | set tagcase=match | " tagcase match, because we mostly use ^] to jump around and that variant respects the upper/lower case [followscs, followic, match, ignore] | ||
208 | set updatetime=80 | " updates the screen more often | 201 | set updatetime=80 | " updates the screen more often |
209 | set viminfo+=% | " restore buffer list | 202 | set redrawtime=1000 | " Timeout in milliseconds for redrawing the screen (switches syntax off when ssh too slow) / CTRL+L to retry |
210 | set virtualedit=all | " virtual edit should be default behaviour, because I don't see any reason against | 203 | set notimeout | " improves performance but is known to cause problems on slow terminals |
211 | set writedelay=0 | 204 | set ttimeout ttimeoutlen=50 | " set esc key timeout in ms- |
205 | set showcmd | " essential: show keys of combined commands in the lower right corner (BUT SLOW, makes cursor flickering) | ||
206 | set showtabline=2 | " 0: never, 1: only if there are at least two tabs, 2:always | ||
207 | set shortmess+=I | " don't give the intro message when starting Vim |:intro|. | ||
212 | set wildmenu | " use a menu in the command line | 208 | set wildmenu | " use a menu in the command line |
213 | set wildmode=longest:full | " do not preselect any entry and show all possible | 209 | set wildmode=longest:full | " do not preselect any entry and show all possible |
210 | |||
211 | " code completion | ||
212 | set complete+=d | " scan current and included files for defined name or macro | ||
213 | set complete+=i | " scan current and included files for completions | ||
214 | set tagcase=match | " tagcase match, because we mostly use ^] to jump around and that variant respects the upper/lower case [followscs, followic, match, ignore] | ||
215 | set tags+=../tags | ||
216 | |||
217 | " code folding... | ||
218 | set nofoldenable | " disable folding, because we have zi to toggle foldenable :) | ||
219 | set foldclose=all | " automatically fold, when the cursor leaves the folded area | ||
220 | set foldcolumn=0 | " I think I don't need this second indicator | ||
221 | set foldmethod=syntax | " foldlevel: syntax, indent, manual | ||
222 | set foldnestmax=1 | " top level folding only | ||
223 | set foldopen=block,hor,search | " when do we unfold? | ||
224 | set foldtext=Foldtext() | " | ||
225 | |||
226 | " vim window behaviour | ||
227 | set splitbelow | " open new windows below the current one (i find that more intuitive) | ||
228 | set winminwidth=0 | " (and all other windows, so TODO: watch out) | ||
229 | set winwidth=30 | " keep NERDTreeWindow at least this size | ||
230 | |||
231 | |||
232 | " vim session handling and restore behaviour | ||
233 | set viminfo+=% | " restore buffer list | ||
214 | set sessionoptions= | 234 | set sessionoptions= |
215 | set sessionoptions+=buffers | 235 | set sessionoptions+=buffers |
216 | set sessionoptions+=curdir | 236 | set sessionoptions+=curdir |
217 | set sessionoptions+=folds | 237 | set sessionoptions+=folds |
238 | set sessionoptions+=resize | ||
239 | set sessionoptions+=slash | ||
218 | set sessionoptions+=tabpages | 240 | set sessionoptions+=tabpages |
241 | set sessionoptions+=unix | ||
219 | set sessionoptions+=winpos | 242 | set sessionoptions+=winpos |
220 | set sessionoptions+=winsize | 243 | set sessionoptions+=winsize |
221 | set sessionoptions+=resize | 244 | |
222 | set sessionoptions+=unix | ||
223 | set sessionoptions+=slash | ||
224 | 245 | ||
225 | " set nocindent smartindent | " use smart indent rather then cindent | 246 | " set nocindent smartindent | " use smart indent rather then cindent |
226 | set noautoindent | 247 | set noautoindent |
@@ -255,7 +276,6 @@ else " default Vim? | |||
255 | set ttyscroll=100 | " improves speed for terminal vim, incomp. with nvim | 276 | set ttyscroll=100 | " improves speed for terminal vim, incomp. with nvim |
256 | set ttyfast | " improves speed for terminal vim (incomp. with nvim) | 277 | set ttyfast | " improves speed for terminal vim (incomp. with nvim) |
257 | set nottybuiltin | " use external termcaps | 278 | set nottybuiltin | " use external termcaps |
258 | " set termguicolors | " When on, uses highlight-guifg and highlight-guibg attributes in the terminal (=24bit color) incomp. with nvim | ||
259 | set restorescreen | " restores the console after exiting vim (intentionally not in nvim) | 279 | set restorescreen | " restores the console after exiting vim (intentionally not in nvim) |
260 | " | 280 | " |
261 | let g:loaded_ruby_provider = 1 " disable ruby support | 281 | let g:loaded_ruby_provider = 1 " disable ruby support |
@@ -408,45 +428,93 @@ if has("autocmd") | |||
408 | set wcm=<C-Z> | 428 | set wcm=<C-Z> |
409 | map <F4> :emenu <C-Z> | 429 | map <F4> :emenu <C-Z> |
410 | 430 | ||
411 | menu &Chdir.Git\ root<tab>:Gcd | 431 | menu &Directory.print\ current\ directory |
412 | \ :Gcd<CR>:pwd<CR> | 432 | \<Tab>:pwd |
433 | \ :pwd<CR> | ||
434 | |||
435 | menu &Directory.-Sep- : | ||
436 | |||
437 | menu &Directory.Change\ to\ GIT\ root | ||
438 | \<Tab>:Gcd | ||
439 | \ :Gcd<CR>:pwd<CR> | ||
413 | 440 | ||
414 | menu &Chdir.current\ buffer<tab>:cd\ %:h | 441 | menu &Directory.Change\ to\ current\ buffers\ directory\ (global) |
415 | \ :cd %:h<CR>:pwd<CR> | 442 | \<tab>:cd\ %:p:h |
443 | \ :cd %:h<CR>:pwd<CR> | ||
416 | 444 | ||
417 | menu &Chdir.current\ buffer<tab>:lcd\ %:p:h | 445 | menu &Directory.Change\ to\ current\ buffers\ directory\ (local\ window)<tab>:lcd\ %:p:h |
418 | \ :lcd %:p:h<CR>:pwd<CR> | 446 | \ :lcd %:p:h<CR>:pwd<CR> |
419 | 447 | ||
420 | menu &Git.&Display\ last\ changes | 448 | menu &Git.&Display\ last\ changes |
421 | \ :let g:signify_vcs_cmds={'git': 'git diff --no-color --no-ext-diff -U0 HEAD^ -- %f'}<CR>:SignifyRefresh<CR> | 449 | \ :let g:signify_vcs_cmds={'git': 'git diff --no-color --no-ext-diff -U0 HEAD^ -- %f'}<CR>:SignifyRefresh<CR> |
422 | 450 | ||
423 | menu &UI.&Open\ in\ Serversession | 451 | menu &Match.Clear\ All\ Matches |
424 | \ :execute ':!nvr --servername /tmp/nvimsocket --remote % +'.line('.')<CR>:stopinsert<CR>:set readonly<CR> | 452 | \<Tab><F6> |
453 | \ :call clearmatches()<CR> | ||
454 | |||
455 | menu &Match.-Sep- : | ||
456 | |||
457 | menu &Match.&dispensable\ white\ spaces | ||
458 | \ :call matchadd("Convention", '\s\+$', 0)<CR> | ||
459 | |||
460 | menu &Match.&long\ lines\ (exeeding\ textwidth) | ||
461 | \ :call matchadd("Convention", '\%>'.&textwidth.'v.', 0)<CR> | ||
425 | 462 | ||
426 | menu &Verify.&Textwidth\ and\ white\ space | 463 | menu &Match.Highlight\ current\ file\ name |
427 | \ :execute ':match Error /\%>'.&textwidth.'v./'<CR> | 464 | \ :call matchadd("Search", escape(expand('%:t'), '.'))<CR> |
428 | \ :2match Error /\s\+$/<CR> | 465 | |
466 | " :execute ':match SpellBad /'.escape(expand('%:t'), '.').'/'<CR> | ||
429 | 467 | ||
430 | menu &Verify.Highlight\ current\ file\ name | ||
431 | \ :execute ':match SpellBad /'.escape(expand('%:t'), '.').'/'<CR> | ||
432 | menu &Window.-Sep- : | 468 | menu &Window.-Sep- : |
433 | 469 | ||
434 | menu &Window.Quickfix\ List | 470 | menu &Window.Quickfix\ List |
435 | \ :copen<CR> | 471 | \ :copen<CR> |
436 | 472 | ||
437 | menu &Window.Location\ List | 473 | menu &Window.Location\ List |
438 | \ :lopen<CR> | 474 | \ :lopen<CR> |
439 | 475 | ||
440 | menu &Window.Scratch | 476 | menu &Window.Scratch |
441 | \ :Scratch<CR> | 477 | \ :Scratch<CR> |
442 | 478 | ||
443 | menu &Find.file\ under\ the\ cursor<Tab>:gf | 479 | |
444 | \ gf | 480 | menu &Find.file\ under\ the\ cursor |
481 | \<Tab>gf | ||
482 | \ gf | ||
483 | |||
484 | menu &Find.Open\ search\ results\ in\ location\ list | ||
485 | \<Tab>:gf | ||
486 | \ :execute ':vimgrep /'.escape(getreg('/'), '.').'/g %'<CR> | ||
487 | \ :copen<CR> | ||
488 | |||
489 | menu &Changes.list | ||
490 | \<Tab>:changes | ||
491 | \ :changes<CR> | ||
492 | menu &Changes.-Sep- : | ||
493 | menu &Changes.previous | ||
494 | \<Tab>g; | ||
495 | \ g; | ||
496 | menu &Changes.next | ||
497 | \<Tab>g, | ||
498 | \ g, | ||
499 | |||
500 | menu &Jump.list | ||
501 | \<Tab>:jumps | ||
502 | \ :jumps<CR> | ||
503 | menu &Jump.-Sep1- : | ||
504 | menu &Jump.previous\ position | ||
505 | \<Tab>CTRL-O | ||
506 | \ <C-O> | ||
507 | menu &Jump.next\ position | ||
508 | \<Tab>CTRL-I | ||
509 | \ <C-I> | ||
510 | menu &Jump.-Sep2- : | ||
511 | menu &Jump.clear\ list | ||
512 | \<Tab>:clearjumps | ||
513 | \ :clearjumps | ||
445 | 514 | ||
515 | menu &UI.&Open\ in\ Serversession | ||
516 | \ :execute ':!nvr --servername /tmp/nvimsocket --remote % +'.line('.')<CR>:stopinsert<CR>:set readonly<CR> | ||
446 | 517 | ||
447 | menu &Find.Open\ search\ results\ in\ location\ list<Tab>:gf | ||
448 | \ :execute ':vimgrep /'.escape(getreg('/'), '.').'/g %'<CR> | ||
449 | \ :copen<CR> | ||
450 | endif | 518 | endif |
451 | 519 | ||
452 | 520 | ||
@@ -618,26 +686,31 @@ let g:lightline_buffer_reservelen = 20 | |||
618 | " \ 'left': [ [ 'bufferinfo' ], [ 'bufferbefore', 'buffercurrent', 'bufferafter' ], ], | 686 | " \ 'left': [ [ 'bufferinfo' ], [ 'bufferbefore', 'buffercurrent', 'bufferafter' ], ], |
619 | let g:lightline = { | 687 | let g:lightline = { |
620 | \ 'tabline': { | 688 | \ 'tabline': { |
621 | \ 'left': [ [ 'bufferinfo' ], [ 'bufferbefore', 'buffercurrent', 'bufferafter' ], ], | 689 | \ 'left': [ [ 'bufferinfo', 'absolutepath' ] ], |
622 | \ 'right': [ [], [ 'close' ] ], | 690 | \ 'right': [ [], [ 'buffer_alt' ] ], |
623 | \ }, | 691 | \ }, |
624 | \ 'colorscheme': 'Tomorrow_Night_Bright', | 692 | \ 'colorscheme': 'Tomorrow_Night', |
625 | \ 'separator': { 'left': "\ue0b0", 'right': "\ue0b2" }, | 693 | \ 'separator': { 'left': "\ue0b0", 'right': "\ue0b2" }, |
626 | \ 'subseparator': { 'left': "\ue0b1", 'right': "\ue0b3" }, | 694 | \ 'subseparator': { 'left': "\ue0b1", 'right': "\ue0b3" }, |
627 | \ 'inactive': { | 695 | \ 'inactive': { |
628 | \ 'left': [['readonly', 'gitbranch', 'absolutepath']]}, | 696 | \ 'left': [ ['gitbranch', 'filename'] ], |
697 | \ 'right': [ [ 'percent', 'lineinfo' ], | ||
698 | \ [ 'spell', 'fileencoding', 'fileformat', 'filetype' ] | ||
699 | \ ] | ||
700 | \ }, | ||
629 | \ 'active': { | 701 | \ 'active': { |
630 | \ 'left': [ [ 'mode', 'paste', 'readonly' ], | 702 | \ 'left': [ [ 'mode', 'paste', 'readonly' ], |
631 | \ [ 'gitbranch', 'absolutepath' ], | 703 | \ [ 'gitbranch', 'filename' ], |
632 | \ [ 'tagbar' ] ], | 704 | \ [ 'tagbar' ] ], |
633 | \ 'right': [ [ 'percent', 'lineinfo' ], | 705 | \ 'right': [ [ 'percent', 'lineinfo' ], |
634 | \ [ 'spell', 'fileencoding', 'fileformat', 'filetype' ] | 706 | \ [ 'spell', 'fileencoding', 'fileformat', 'filetype' ] |
635 | \ ], | 707 | \ ] |
636 | \ }, | 708 | \ }, |
637 | \ 'component': { | 709 | \ 'component': { |
638 | \ 'tagbar': '%{substitute(tagbar#currenttag("%s", "", "fs"), "\(.*\)", "", "")}', | 710 | \ 'tagbar': '%{substitute(tagbar#currenttag("%s", "", "fs"), "\(.*\)", "", "")}', |
639 | \ 'ycmparent': '%{substitute(execute("YcmComplete GetParent"), "\(.*\)", "", "")}', | 711 | \ 'ycmparent': '%{substitute(execute("YcmComplete GetParent"), "\(.*\)", "", "")}', |
640 | \ 'filename': '%t' | 712 | \ 'filename': '%t', |
713 | \ 'buffer_alt': '#:%{expand("#:t")}' | ||
641 | \ }, | 714 | \ }, |
642 | \ 'component_expand': { | 715 | \ 'component_expand': { |
643 | \ 'buffercurrent': 'lightline#buffer#buffercurrent2', | 716 | \ 'buffercurrent': 'lightline#buffer#buffercurrent2', |
@@ -657,45 +730,67 @@ let g:lightline = { | |||
657 | \ }, | 730 | \ }, |
658 | \ } | 731 | \ } |
659 | 732 | ||
660 | function! ExtendLightlineColorTheme() | 733 | set noshowmode | " mode will be shown twice, in lightline and below, so we want to deactivate one |
661 | highlight! link LightlineMiddle_normal Normal | 734 | set statusline= |
662 | endfunction | 735 | set statusline+=%t%m |
663 | 736 | set statusline+=%{TagInStatusLine()} | |
664 | autocmd! ColorScheme * call ExtendLightlineColorTheme() | 737 | set statusline+=%#warningmsg# |
738 | set statusline+=%{SyntasticStatuslineFlag()} | ||
739 | set statusline+=%*%= | ||
740 | set statusline+=%l:%c(%p%%) | ||
665 | 741 | ||
666 | " Autocompleter: ===================================== | 742 | " Autocompleter: ===================================== |
667 | " if has("python") | 743 | " if has("python") |
744 | |||
745 | " ULTISNIPS: code snippet ============================================================================================ | ||
746 | Plug 'honza/vim-snippets' " dependency of ultisnips (see below) | ||
747 | Plug 'SirVer/ultisnips' " replaces loremipsum (and many more) | ||
748 | 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) | ||
749 | |||
750 | let g:UltiSnipsJumpForwardTrigger = '<Tab>'| | ||
751 | let g:UltiSnipsJumpBackwardTrigger = '<S-Tab>'| | ||
752 | "d let g:UltiSnipsJumpForwardTrigger = '<PageDown>' | ||
753 | " let g:UltiSnipsJumpBackwardTrigger = '<PageUp>' | ||
754 | "let g:UltiSnipsExpandTrigger = '<C-j>'| " Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe. | ||
755 | "let g:UltiSnipsJumpForwardTrigger = '<C-j>'| " \ | ||
756 | "let g:UltiSnipsJumpBackwardTrigger = '<C-k>'| " \ | ||
757 | "let g:UltiSnipsListSnippets = '<C-`>'| " YouCompleteMe includes those, so this isn't necessary | ||
758 | "let g:UltiSnipsListSnippets = '<leader><leader>'| " YouCompleteMe includes those, so this isn't necessary | ||
759 | """ Ultisnips | ||
760 | " let g:UltiSnipsExpandTrigger="<c-tab>" | ||
761 | " let g:UltiSnipsListSnippets="<c-s-tab>" | ||
762 | |||
668 | " YouCompleteMe: ===================================================================================================== | 763 | " YouCompleteMe: ===================================================================================================== |
669 | " Plug 'Valloric/MatchTagAlways' " highlights the closing tag/brace/... | 764 | " Plug 'Valloric/MatchTagAlways' " highlights the closing tag/brace/... |
670 | Plug 'Valloric/YouCompleteMe' | 765 | Plug 'Valloric/YouCompleteMe' |
671 | " Plug 'vim-scripts/dbext.vim' " dependency to allow db related completions | ||
672 | let g:ycm_server_python_interpreter = 'python3' | ||
673 | let g:ycm_python_binary_path = '/usr/bin/python3' " the python interpreter of choice (for code checking) | ||
674 | let g:ycm_add_preview_to_completeopt = 1 " reuse existing preview window | ||
675 | let g:ycm_autoclose_preview_window_after_insertion = 1 | ||
676 | let g:ycm_collect_identifiers_from_tags_files = 0 " Let YCM read tags from Ctags file | ||
677 | let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword | ||
678 | let g:ycm_complete_in_comments = 1 " Completion in comments | ||
679 | let g:ycm_complete_in_strings = 1 " Completion in string | ||
680 | let g:ycm_error_symbol = '✖' " insert this as an error symbol in the gutter bar | 766 | let g:ycm_error_symbol = '✖' " insert this as an error symbol in the gutter bar |
681 | let g:ycm_auto_trigger = 1 | ||
682 | 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 | ||
683 | let g:ycm_min_num_identifier_candidate_chars = 4 | ||
684 | |||
685 | let g:ycm_max_num_identifier_candidates = 10 | ||
686 | let g:ycm_max_num_candidates = 50 | ||
687 | |||
688 | |||
689 | let g:ycm_use_ultisnips_completer = 1 " Default 1, just ensure | ||
690 | let g:ycm_warning_symbol = '➔' " insert this as a warning symbol in the gutter bar | 767 | let g:ycm_warning_symbol = '➔' " insert this as a warning symbol in the gutter bar |
691 | let g:ycm_confirm_extra_conf = 0 " security is overrated | 768 | let g:ycm_auto_trigger = 1 |
692 | let g:ycm_key_list_select_completion = ['<Down>'] | 769 | let g:ycm_autoclose_preview_window_after_insertion = 1 |
693 | let g:ycm_key_list_previous_completion = ['<Up>'] | 770 | " Plug 'vim-scripts/dbext.vim' " dependency to allow db related completions |
694 | let g:ycm_global_ycm_extra_conf = '.ycm_extra_conf.py' | 771 | " let g:ycm_server_python_interpreter = 'python3' |
695 | let g:ycm_semantic_triggers = { 'c': [ 're!.' ] } | 772 | " let g:ycm_python_binary_path = '/usr/bin/python3' " the python interpreter of choice (for code checking) |
696 | " let g:ycm_disable_for_files_larger_than_kb = 16384 " we have faaast computers, don't we? | 773 | " let g:ycm_add_preview_to_completeopt = 1 " reuse existing preview window |
697 | let g:ycm_show_diagnostics_ui = 0 | 774 | " let g:ycm_collect_identifiers_from_tags_files = 0 " Let YCM read tags from Ctags file |
698 | " disable <tab>-key for YCM so that it can be used with ultisnips | 775 | " let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword |
776 | " let g:ycm_complete_in_comments = 1 " Completion in comments | ||
777 | " let g:ycm_complete_in_strings = 1 " Completion in string | ||
778 | " 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!) | ||
779 | " let g:ycm_min_num_identifier_candidate_chars = 4 | ||
780 | |||
781 | " let g:ycm_max_num_identifier_candidates = 10 | ||
782 | " let g:ycm_max_num_candidates = 50 | ||
783 | |||
784 | |||
785 | " let g:ycm_use_ultisnips_completer = 1 " Default 1, just ensure | ||
786 | " let g:ycm_confirm_extra_conf = 0 " security is overrated | ||
787 | " let g:ycm_key_list_select_completion = ['<Down>'] | ||
788 | " let g:ycm_key_list_previous_completion = ['<Up>'] | ||
789 | " let g:ycm_global_ycm_extra_conf = '.ycm_extra_conf.py' | ||
790 | " let g:ycm_semantic_triggers = { 'c': [ 're!.' ] } | ||
791 | " " let g:ycm_disable_for_files_larger_than_kb = 16384 " we have faaast computers, don't we? | ||
792 | " let g:ycm_show_diagnostics_ui = 0 | ||
793 | " " disable <tab>-key for YCM so that it can be used with ultisnips | ||
699 | let g:ycm_key_list_select_completion=[] | 794 | let g:ycm_key_list_select_completion=[] |
700 | let g:ycm_key_list_previous_completion=[] | 795 | let g:ycm_key_list_previous_completion=[] |
701 | 796 | ||
@@ -720,18 +815,6 @@ autocmd! ColorScheme * call ExtendLightlineColorTheme() | |||
720 | let g:syntastic_warning_symbol = '➔' | 815 | let g:syntastic_warning_symbol = '➔' |
721 | let g:syntastic_style_warning_symbol = '≈' | 816 | let g:syntastic_style_warning_symbol = '≈' |
722 | 817 | ||
723 | " ULTISNIPS: code snippet ============================================================================================== | ||
724 | Plug 'honza/vim-snippets' " dependency of ultisnips (see below) | ||
725 | Plug 'SirVer/ultisnips' " replaces loremipsum (and many more) | ||
726 | "let g:UltiSnipsExpandTrigger = '<C-j>'| " Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe. | ||
727 | "let g:UltiSnipsJumpForwardTrigger = '<C-j>'| " \ | ||
728 | "let g:UltiSnipsJumpBackwardTrigger = '<C-k>'| " \ | ||
729 | "let g:UltiSnipsListSnippets = '<C-`>'| " YouCompleteMe includes those, so this isn't necessary | ||
730 | "let g:UltiSnipsExpandTrigger = '<leader><tab>'| " Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe. | ||
731 | "let g:UltiSnipsJumpForwardTrigger = '<PageDown>'| " \ | ||
732 | "let g:UltiSnipsJumpBackwardTrigger = '<PageUp>'| " \ | ||
733 | "let g:UltiSnipsListSnippets = '<leader><leader>'| " YouCompleteMe includes those, so this isn't necessary | ||
734 | |||
735 | " JEDI: ============================================================================================================== | 818 | " JEDI: ============================================================================================================== |
736 | Plug 'davidhalter/jedi-vim' " jedi gets used to display python function signatures | 819 | Plug 'davidhalter/jedi-vim' " jedi gets used to display python function signatures |
737 | let g:jedi#completions_enabled = 0 " we do not need completions, because we have YouCompleteMe | 820 | let g:jedi#completions_enabled = 0 " we do not need completions, because we have YouCompleteMe |
@@ -799,7 +882,7 @@ function! ExtendColorTheme() | |||
799 | " highlight! NonText guibg=NONE guifg=black ctermbg=NONE ctermfg=black | 882 | " highlight! NonText guibg=NONE guifg=black ctermbg=NONE ctermfg=black |
800 | 883 | ||
801 | " make the ~ (tilde) indicator invisible, which usually marks the EOF | 884 | " make the ~ (tilde) indicator invisible, which usually marks the EOF |
802 | highlight! EndOfBuffer ctermfg=bg | 885 | highlight! link EndOfBuffer Ignore |
803 | 886 | ||
804 | highlight! CursorLineNr cterm=inverse | " ctermbg=black ctermfg=NONE | 887 | highlight! CursorLineNr cterm=inverse | " ctermbg=black ctermfg=NONE |
805 | highlight! Pmenu ctermbg=LightYellow ctermfg=DarkGrey | 888 | highlight! Pmenu ctermbg=LightYellow ctermfg=DarkGrey |
@@ -830,16 +913,27 @@ function! ExtendColorTheme() | |||
830 | highlight! link SpecialKey NonText | 913 | highlight! link SpecialKey NonText |
831 | 914 | ||
832 | 915 | ||
833 | " Show trailing whitepace and spaces before a tab as part of the syntax highlighting | ||
834 | autocmd Syntax * syn match Error /\s\+$\| \+\ze\t/ containedin=ALL | ||
835 | " automatically enter list mode when going in insert mode (makes above syntax command temporarily ineffective) | 916 | " automatically enter list mode when going in insert mode (makes above syntax command temporarily ineffective) |
836 | autocmd InsertEnter * set list | 917 | autocmd InsertEnter * set list |
837 | autocmd InsertLeave * set nolist | 918 | autocmd InsertLeave * set nolist |
919 | |||
920 | " Show trailing whitepace and spaces before a tab as part of the syntax highlighting | ||
921 | highlight! link Convention Error | ||
922 | autocmd BufEnter,InsertLeave * syntax match Convention /\s\+$\| \+\ze\t/ containedin=ALL | ||
923 | autocmd InsertEnter * syntax clear Convention | ||
924 | " autocmd BufEnter,InsertLeave * execute ':syntax match Convention /\%>'.&textwidth.'v./ containedin=ALL' | ||
925 | |||
926 | autocmd InsertEnter * set colorcolumn=80,120 | ||
927 | autocmd InsertLeave * set colorcolumn& | ||
928 | " set colorcolumn= | " not used, because we have a :match directive for textwidth | ||
929 | |||
838 | endfunction | 930 | endfunction |
839 | autocmd! ColorScheme * call ExtendColorTheme() | 931 | autocmd! ColorScheme * call ExtendColorTheme() |
840 | 932 | ||
841 | 933 | ||
842 | " colorscheme PaperColor | 934 | set termguicolors | " When on, uses highlight-guifg and highlight-guibg attributes in the terminal (=24bit color) incomp. with nvim |
935 | " set background=dark | ||
936 | set t_ut= | ||
843 | if filereadable(expand("~/.config/base16-shell/colortest")) | 937 | if filereadable(expand("~/.config/base16-shell/colortest")) |
844 | let g:base16_shell_path="~/.config/base16-shell/scripts" | 938 | let g:base16_shell_path="~/.config/base16-shell/scripts" |
845 | endif | 939 | endif |
@@ -851,7 +945,6 @@ else | |||
851 | colorscheme base16-phd | 945 | colorscheme base16-phd |
852 | endif | 946 | endif |
853 | 947 | ||
854 | " set background=dark | ||
855 | 948 | ||
856 | " ====================================================================================================================== | 949 | " ====================================================================================================================== |
857 | " TESTING: | 950 | " TESTING: |
@@ -861,8 +954,7 @@ endif | |||
861 | " silent autocmd VimEnter * nested :silent bun | 954 | " silent autocmd VimEnter * nested :silent bun |
862 | " endif | 955 | " endif |
863 | 956 | ||
864 | set scrolloff=0 | " keeps cursor centered | ||
865 | autocmd VimEnter,WinEnter * exec ':set scrolljump='.winheight(0)/2 | 957 | autocmd VimEnter,WinEnter * exec ':set scrolljump='.winheight(0)/2 |
866 | 958 | ||
867 | " display highlight group under the cursor | 959 | " display highlight group under the cursor |
868 | map <leader>h :echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')<CR> | 960 | map <leader>h :echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')<CR> |