diff options
author | Max Christian Pohle | 2017-05-07 22:01:06 +0200 |
---|---|---|
committer | Max Christian Pohle | 2017-05-07 22:01:06 +0200 |
commit | 42822d1b36b299e5ebef52e2666c7f5166069383 (patch) | |
tree | 8941adcaf51539d837d86d2c7e30d43028937353 /vimrc-full | |
parent | 4a6d3efdcd52a7e358af30027acf6950010e26be (diff) | |
download | vim-karlmarks-42822d1b36b299e5ebef52e2666c7f5166069383.tar.bz2 vim-karlmarks-42822d1b36b299e5ebef52e2666c7f5166069383.zip |
Autocommand magic
Diffstat (limited to 'vimrc-full')
-rw-r--r-- | vimrc-full | 123 |
1 files changed, 73 insertions, 50 deletions
@@ -1,4 +1,12 @@ | |||
1 | " vim: textwidth=160 tabstop=2 shiftwidth=2 tw=160 colorcolumn=160 | 1 | " vim: tabstop=2 softtabstop=2 shiftwidth=2 textwidth=160 |
2 | |||
3 | set t_Co=256 | " required on some ssh sessions | ||
4 | let &t_Co=256 | " | ||
5 | " set background=light | " | ||
6 | " set term=xtermc | " may be required on solaris | ||
7 | set term=xterm-256color | ||
8 | " set termguicolors | ||
9 | |||
2 | 10 | ||
3 | " START: LOADING PLUGINS | 11 | " START: LOADING PLUGINS |
4 | " ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ | 12 | " ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ |
@@ -34,6 +42,7 @@ nnoremap <F12> :ToggleBufExplorer<CR> | |||
34 | " AIRLINE: a fancy status line ========================================================================================= | 42 | " AIRLINE: a fancy status line ========================================================================================= |
35 | Plug 'vim-airline/vim-airline' | " beautification of the mode line | 43 | Plug 'vim-airline/vim-airline' | " beautification of the mode line |
36 | set laststatus=2 | " required by AirLine, without status line does not appear until a window split | 44 | set laststatus=2 | " required by AirLine, without status line does not appear until a window split |
45 | set background=light | ||
37 | let g:airline_extensions = ['tabline', 'branch', 'syntastic', 'tagbar', 'whitespace', 'ycm'] | 46 | let g:airline_extensions = ['tabline', 'branch', 'syntastic', 'tagbar', 'whitespace', 'ycm'] |
38 | let b:airline_whitespace_checks = ['indent', 'trailing', 'long', 'mixed-indent-file'] | 47 | let b:airline_whitespace_checks = ['indent', 'trailing', 'long', 'mixed-indent-file'] |
39 | " let g:airline_section_c = "" | " was: %F | 48 | " let g:airline_section_c = "" | " was: %F |
@@ -56,7 +65,11 @@ let g:airline_powerline_fonts = 1 | | |||
56 | let g:airline_skip_empty_sections = 1 | | 65 | let g:airline_skip_empty_sections = 1 | |
57 | " AIRLINE_Theme: | 66 | " AIRLINE_Theme: |
58 | Plug 'vim-airline/vim-airline-themes' | " airline themes to match any light and dark terminal using :AirlineTheme | 67 | Plug 'vim-airline/vim-airline-themes' | " airline themes to match any light and dark terminal using :AirlineTheme |
59 | let g:airline_theme='base16' | " specifies which colorscheme should airline uses | 68 | let base16colorspace = 256 |
69 | let g:airline_theme='base16' | " specifies which colorscheme should airline uses | ||
70 | " let g:solarized_base16 = 1 | ||
71 | " let g:airline_base16_improved_contrast = 1 | ||
72 | let g:airline#themes#base16#constant = 0 | ||
60 | " let g:airline_theme='badcat' | " specifies which colorscheme should airline uses | 73 | " let g:airline_theme='badcat' | " specifies which colorscheme should airline uses |
61 | " let g:airline_theme='papercolor' | " specifies which colorscheme should ionirline uses | 74 | " let g:airline_theme='papercolor' | " specifies which colorscheme should ionirline uses |
62 | 75 | ||
@@ -200,6 +213,49 @@ call plug#end() | " all plugins are gettin | |||
200 | " END: LOADING PLUGINS | 213 | " END: LOADING PLUGINS |
201 | 214 | ||
202 | 215 | ||
216 | |||
217 | " COLORSCHEME: | ||
218 | |||
219 | " uses the default terminal background color as background (allows transparency) | ||
220 | |||
221 | |||
222 | function! ExtendColorTheme() | ||
223 | " highlight! Normal ctermbg=NONE ctermfg=black cterm=inverse | ||
224 | highlight! Normal ctermbg=NONE | ||
225 | highlight! CursorLineNr cterm=inverse | " ctermbg=black ctermfg=NONE | ||
226 | highlight! Pmenu ctermbg=LightYellow ctermfg=blue guibg=LightYellow guifg=blue cterm=italic | ||
227 | highlight! PmenuSel ctermbg=LightYellow ctermfg=blue guibg=LightYellow guifg=blue gui=inverse cterm=inverse | ||
228 | highlight! link PmenuSbar Pmenu | ||
229 | highlight! PmenuThumb cterm=inverse | ||
230 | highlight! MoreMsg cterm=inverse | ||
231 | highlight! link Folded LineNr | ||
232 | highlight! Cursor guibg=green ctermbg=yellow | ||
233 | highlight! link VertSplit LineNr | ||
234 | highlight! SpellBad ctermbg=none | ||
235 | |||
236 | syntax on | " enable syntax highlighting | ||
237 | syntax sync minlines=60 | " how many preceding lines will be parsed? (has performance impact) | ||
238 | endfunction | ||
239 | autocmd ColorScheme * call ExtendColorTheme() | ||
240 | |||
241 | |||
242 | |||
243 | let g:base16_shell_path="/home/max/.config/base16-shell/scrips/" | ||
244 | let base16colorspace=256 | ||
245 | if filereadable(expand("~/.vimrc_background")) | ||
246 | source ~/.vimrc_background | ||
247 | else | ||
248 | colorscheme base16-phd | ||
249 | " colorscheme base16-embers | ||
250 | " colorscheme base16-flat | ||
251 | " colorscheme base16-summerfruit-dark | ||
252 | " colorscheme base16-tommorow | ||
253 | " colorscheme base16-default-dark | ||
254 | endif | ||
255 | |||
256 | |||
257 | |||
258 | |||
203 | "======================================================================================================================= | 259 | "======================================================================================================================= |
204 | " GENERAL: | 260 | " GENERAL: |
205 | "======================================================================================================================= | 261 | "======================================================================================================================= |
@@ -207,8 +263,6 @@ filetype on | |||
207 | filetype plugin on | 263 | filetype plugin on |
208 | filetype indent on | 264 | filetype indent on |
209 | 265 | ||
210 | syntax on | " enable syntax highlighting | ||
211 | syntax sync minlines=60 | " how many preceding lines will be parsed? (has performance impact) | ||
212 | 266 | ||
213 | "======================================================================================================================= | 267 | "======================================================================================================================= |
214 | " SPELL_CHECKING: | 268 | " SPELL_CHECKING: |
@@ -278,58 +332,14 @@ set colorcolumn= | " not used, because we have a :match directive f | |||
278 | set ts=4 sts=4 sw=4 expandtab | " better done with a modeline | 332 | set ts=4 sts=4 sw=4 expandtab | " better done with a modeline |
279 | set updatetime=1000 | " updates the screen more often | 333 | set updatetime=1000 | " updates the screen more often |
280 | set writedelay=0 | 334 | set writedelay=0 |
281 | set lcs+=space:· | " local space char | ||
282 | "======================================================================================================================= | 335 | "======================================================================================================================= |
283 | " COLORSCHEME: | ||
284 | " set term=xtermc | " may be required on solaris | ||
285 | set t_Co=256 | " required on some ssh sessions | ||
286 | let &t_Co=256 | ||
287 | " set termguicolors | ||
288 | " set background=light | " hint how the terminal background looks like | ||
289 | |||
290 | " uses the default terminal background color as background (allows transparency) | ||
291 | " autocmd Colorscheme * set background=dark | ||
292 | |||
293 | |||
294 | " set termguicolors | ||
295 | let base16colorspace=256 | ||
296 | if filereadable(expand("~/.vimrc_background")) | ||
297 | set background=light | ||
298 | source ~/.vimrc_background | ||
299 | else | ||
300 | colorscheme base16-phd | ||
301 | " colorscheme base16-embers | ||
302 | " colorscheme base16-flat | ||
303 | " colorscheme base16-summerfruit-dark | ||
304 | " colorscheme base16-tommorow | ||
305 | " colorscheme base16-default-dark | ||
306 | endif | ||
307 | |||
308 | " highlight Normal ctermbg=NONE ctermfg=white | ||
309 | highlight NonText ctermbg=NONE ctermfg=white | ||
310 | highlight! CursorLineNr cterm=inverse | " ctermbg=black ctermfg=NONE | ||
311 | highlight! Pmenu ctermbg=LightYellow ctermfg=blue cterm=italic | ||
312 | highlight! MoreMsg cterm=inverse | ||
313 | highlight! link Folded LineNr | ||
314 | highlight Cursor guibg=green | ||
315 | highlight! link VertSplit LineNr | ||
316 | execute ':match ColorColumn /\%>'.&textwidth.'v./' | ||
317 | 336 | ||
318 | |||
319 | set fillchars+=fold:\ | " | ||
320 | set fillchars+=vert:\│ | " cool vertical split char | ||
321 | " set fillchars+=stlnc:\― | " | 337 | " set fillchars+=stlnc:\― | " |
322 | 338 | ||
323 | 339 | ||
324 | |||
325 | |||
326 | |||
327 | |||
328 | " let &t_EI .= "\<Esc>[0 q" | ||
329 | " let &t_SI = "\<Esc>]12;green\x7" | ||
330 | if has('autocmd') | 340 | if has('autocmd') |
331 | autocmd VimEnter * let &t_EI .= "\<Esc>[0 q" | 341 | " autocmd VimEnter * let &t_EI .= "\<Esc>[0 q" |
332 | autocmd VimEnter * let &t_SI = "\<Esc>]12;black\x7" | 342 | " autocmd VimEnter * let &t_SI = "\<Esc>]12;green\x7" |
333 | autocmd VimLeave * silent !echo -ne "\033]112\007" | 343 | autocmd VimLeave * silent !echo -ne "\033]112\007" |
334 | endif | 344 | endif |
335 | 345 | ||
@@ -339,6 +349,9 @@ if has("multi_byte") | |||
339 | set encoding=utf-8 | " we need default utf-8 encoding to use cool chars as line break and so on (see below) | 349 | set encoding=utf-8 | " we need default utf-8 encoding to use cool chars as line break and so on (see below) |
340 | set termencoding=&encoding | " once we use special chars we assume everybody uses a terminal supporting those | 350 | set termencoding=&encoding | " once we use special chars we assume everybody uses a terminal supporting those |
341 | 351 | ||
352 | set fillchars+=fold:\ | " | ||
353 | set fillchars+=vert:\│ | " cool vertical split char | ||
354 | |||
342 | set listchars= | " initialize empty listchars | 355 | set listchars= | " initialize empty listchars |
343 | set listchars+=extends:» | " symbols used when using :set list (which displays non-printable chars) | 356 | set listchars+=extends:» | " symbols used when using :set list (which displays non-printable chars) |
344 | set listchars+=precedes:« | " symbols used when using :set list (which displays non-printable chars) | 357 | set listchars+=precedes:« | " symbols used when using :set list (which displays non-printable chars) |
@@ -472,6 +485,14 @@ if has("autocmd") | |||
472 | augroup END | 485 | augroup END |
473 | endif | 486 | endif |
474 | 487 | ||
488 | " use the shada/viminfo file to return the cursor to where it was... | ||
489 | function! ReturnCursor() | ||
490 | if line("'\"") > 1 && line("'\"") <= line("$") | ||
491 | exe "normal! g`\"" | ||
492 | endif | ||
493 | endfunction | ||
494 | autocmd! BufReadPost * call ReturnCursor() | ||
495 | |||
475 | 496 | ||
476 | augroup ToggleQuickFix | 497 | augroup ToggleQuickFix |
477 | function! ToggleQuickFix() | 498 | function! ToggleQuickFix() |
@@ -510,6 +531,7 @@ if has("autocmd") | |||
510 | augroup CurrentFileName | 531 | augroup CurrentFileName |
511 | highlight CurrentFileName ctermbg=yellow guibg=yellow | 532 | highlight CurrentFileName ctermbg=yellow guibg=yellow |
512 | 533 | ||
534 | let @w = ":execute ':match ColorColumn /\\%>'.&textwidth.'v./'" | ||
513 | " highlight the current files name inside the document... | 535 | " highlight the current files name inside the document... |
514 | let @g = ":exe ':match CurrentFileName /'.escape(expand('%:t'), '.').'/'" | 536 | let @g = ":exe ':match CurrentFileName /'.escape(expand('%:t'), '.').'/'" |
515 | " put the current files name after the cursor... | 537 | " put the current files name after the cursor... |
@@ -618,3 +640,4 @@ let g:netrw_winsize = 20 | " window size in percent | |||
618 | 640 | ||
619 | 641 | ||
620 | " autocmd BufEnter * lcd %:p:h | " Plugin vim-rooter get used instead (which is much more sane as well) | 642 | " autocmd BufEnter * lcd %:p:h | " Plugin vim-rooter get used instead (which is much more sane as well) |
643 | " set termguicolors | ||