From 42822d1b36b299e5ebef52e2666c7f5166069383 Mon Sep 17 00:00:00 2001 From: Max Christian Pohle Date: Sun, 7 May 2017 22:01:06 +0200 Subject: Autocommand magic --- doc/shortcuts.txt | 6 ++- vimrc-full | 123 ++++++++++++++++++++++++++++++++---------------------- 2 files changed, 78 insertions(+), 51 deletions(-) diff --git a/doc/shortcuts.txt b/doc/shortcuts.txt index 3dd389f..8c0d773 100644 --- a/doc/shortcuts.txt +++ b/doc/shortcuts.txt @@ -86,9 +86,12 @@ do = get changes from other window into the current dp = put changes from current window into the other ]c = jump to the next change [c = jump to the prevous change + +[folds] +za = toggle a fold +zM = close all folds zR = opens all folds (unfold all) zE = eliminates all folds -z= = show spellcheck suggestions [buffers] @@ -102,6 +105,7 @@ z= = show spellcheck suggestions [special] g CTRL-g = display file properties including word and char count q: = show command history and use it like a normal buffer +z= = show spellcheck suggestions [completions] diff --git a/vimrc-full b/vimrc-full index f4a9faa..d96702d 100644 --- a/vimrc-full +++ b/vimrc-full @@ -1,4 +1,12 @@ -" vim: textwidth=160 tabstop=2 shiftwidth=2 tw=160 colorcolumn=160 +" vim: tabstop=2 softtabstop=2 shiftwidth=2 textwidth=160 + +set t_Co=256 | " required on some ssh sessions +let &t_Co=256 | " +" set background=light | " +" set term=xtermc | " may be required on solaris +set term=xterm-256color +" set termguicolors + " START: LOADING PLUGINS " ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ @@ -34,6 +42,7 @@ nnoremap :ToggleBufExplorer " AIRLINE: a fancy status line ========================================================================================= Plug 'vim-airline/vim-airline' | " beautification of the mode line set laststatus=2 | " required by AirLine, without status line does not appear until a window split +set background=light let g:airline_extensions = ['tabline', 'branch', 'syntastic', 'tagbar', 'whitespace', 'ycm'] let b:airline_whitespace_checks = ['indent', 'trailing', 'long', 'mixed-indent-file'] " let g:airline_section_c = "" | " was: %F @@ -56,7 +65,11 @@ let g:airline_powerline_fonts = 1 | let g:airline_skip_empty_sections = 1 | " AIRLINE_Theme: Plug 'vim-airline/vim-airline-themes' | " airline themes to match any light and dark terminal using :AirlineTheme -let g:airline_theme='base16' | " specifies which colorscheme should airline uses +let base16colorspace = 256 +let g:airline_theme='base16' | " specifies which colorscheme should airline uses +" let g:solarized_base16 = 1 +" let g:airline_base16_improved_contrast = 1 +let g:airline#themes#base16#constant = 0 " let g:airline_theme='badcat' | " specifies which colorscheme should airline uses " let g:airline_theme='papercolor' | " specifies which colorscheme should ionirline uses @@ -200,6 +213,49 @@ call plug#end() | " all plugins are gettin " END: LOADING PLUGINS + +" COLORSCHEME: + +" uses the default terminal background color as background (allows transparency) + + +function! ExtendColorTheme() + " highlight! Normal ctermbg=NONE ctermfg=black cterm=inverse + highlight! Normal ctermbg=NONE + highlight! CursorLineNr cterm=inverse | " ctermbg=black ctermfg=NONE + highlight! Pmenu ctermbg=LightYellow ctermfg=blue guibg=LightYellow guifg=blue cterm=italic + highlight! PmenuSel ctermbg=LightYellow ctermfg=blue guibg=LightYellow guifg=blue gui=inverse cterm=inverse + highlight! link PmenuSbar Pmenu + highlight! PmenuThumb cterm=inverse + highlight! MoreMsg cterm=inverse + highlight! link Folded LineNr + highlight! Cursor guibg=green ctermbg=yellow + highlight! link VertSplit LineNr + highlight! SpellBad ctermbg=none + + syntax on | " enable syntax highlighting + syntax sync minlines=60 | " how many preceding lines will be parsed? (has performance impact) +endfunction +autocmd ColorScheme * call ExtendColorTheme() + + + +let g:base16_shell_path="/home/max/.config/base16-shell/scrips/" +let base16colorspace=256 +if filereadable(expand("~/.vimrc_background")) + source ~/.vimrc_background +else + colorscheme base16-phd +" colorscheme base16-embers +" colorscheme base16-flat +" colorscheme base16-summerfruit-dark +" colorscheme base16-tommorow +" colorscheme base16-default-dark +endif + + + + "======================================================================================================================= " GENERAL: "======================================================================================================================= @@ -207,8 +263,6 @@ filetype on filetype plugin on filetype indent on -syntax on | " enable syntax highlighting -syntax sync minlines=60 | " how many preceding lines will be parsed? (has performance impact) "======================================================================================================================= " SPELL_CHECKING: @@ -278,58 +332,14 @@ set colorcolumn= | " not used, because we have a :match directive f set ts=4 sts=4 sw=4 expandtab | " better done with a modeline set updatetime=1000 | " updates the screen more often set writedelay=0 -set lcs+=space:· | " local space char "======================================================================================================================= -" COLORSCHEME: -" set term=xtermc | " may be required on solaris -set t_Co=256 | " required on some ssh sessions -let &t_Co=256 -" set termguicolors -" set background=light | " hint how the terminal background looks like - -" uses the default terminal background color as background (allows transparency) -" autocmd Colorscheme * set background=dark - - -" set termguicolors -let base16colorspace=256 -if filereadable(expand("~/.vimrc_background")) - set background=light - source ~/.vimrc_background -else - colorscheme base16-phd -" colorscheme base16-embers -" colorscheme base16-flat -" colorscheme base16-summerfruit-dark -" colorscheme base16-tommorow -" colorscheme base16-default-dark -endif - -" highlight Normal ctermbg=NONE ctermfg=white -highlight NonText ctermbg=NONE ctermfg=white -highlight! CursorLineNr cterm=inverse | " ctermbg=black ctermfg=NONE -highlight! Pmenu ctermbg=LightYellow ctermfg=blue cterm=italic -highlight! MoreMsg cterm=inverse -highlight! link Folded LineNr -highlight Cursor guibg=green -highlight! link VertSplit LineNr -execute ':match ColorColumn /\%>'.&textwidth.'v./' - -set fillchars+=fold:\ | " -set fillchars+=vert:\│ | " cool vertical split char " set fillchars+=stlnc:\― | " - - - - -" let &t_EI .= "\[0 q" -" let &t_SI = "\]12;green\x7" if has('autocmd') - autocmd VimEnter * let &t_EI .= "\[0 q" - autocmd VimEnter * let &t_SI = "\]12;black\x7" + " autocmd VimEnter * let &t_EI .= "\[0 q" + " autocmd VimEnter * let &t_SI = "\]12;green\x7" autocmd VimLeave * silent !echo -ne "\033]112\007" endif @@ -339,6 +349,9 @@ if has("multi_byte") set encoding=utf-8 | " we need default utf-8 encoding to use cool chars as line break and so on (see below) set termencoding=&encoding | " once we use special chars we assume everybody uses a terminal supporting those + set fillchars+=fold:\ | " + set fillchars+=vert:\│ | " cool vertical split char + set listchars= | " initialize empty listchars set listchars+=extends:» | " symbols used when using :set list (which displays non-printable chars) set listchars+=precedes:« | " symbols used when using :set list (which displays non-printable chars) @@ -472,6 +485,14 @@ if has("autocmd") augroup END endif + " use the shada/viminfo file to return the cursor to where it was... + function! ReturnCursor() + if line("'\"") > 1 && line("'\"") <= line("$") + exe "normal! g`\"" + endif + endfunction + autocmd! BufReadPost * call ReturnCursor() + augroup ToggleQuickFix function! ToggleQuickFix() @@ -510,6 +531,7 @@ if has("autocmd") augroup CurrentFileName highlight CurrentFileName ctermbg=yellow guibg=yellow + let @w = ":execute ':match ColorColumn /\\%>'.&textwidth.'v./'" " highlight the current files name inside the document... let @g = ":exe ':match CurrentFileName /'.escape(expand('%:t'), '.').'/'" " put the current files name after the cursor... @@ -618,3 +640,4 @@ let g:netrw_winsize = 20 | " window size in percent " autocmd BufEnter * lcd %:p:h | " Plugin vim-rooter get used instead (which is much more sane as well) +" set termguicolors -- cgit v1.2.3