aboutsummaryrefslogtreecommitdiff
path: root/vimrc
diff options
context:
space:
mode:
Diffstat (limited to 'vimrc')
-rw-r--r--vimrc534
1 files changed, 270 insertions, 264 deletions
diff --git a/vimrc b/vimrc
index cca37a8..e18b9f5 100644
--- a/vimrc
+++ b/vimrc
@@ -1,84 +1,70 @@
1" vim: textwidth=160 tabstop=2 shiftwidth=2 1" vim: textwidth=160 tabstop=2 shiftwidth=2 tw=160 colorcolumn=160
2"
3if has('nvim')
4 runtime! python_setup.vim
5endif
6 2
3" START: LOADING PLUGINS
4" ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
7call plug#begin() 5call plug#begin()
8 6
7Plug 'tpope/vim-surround' | " plugin makes cs"' inside a line replace " with '
8Plug 'tpope/vim-fugitive' | " the most complete GIT integration plugin
9Plug 'godlygeek/tabular' | " align code on a sign, like :Tab/=
10Plug 'ryanoasis/vim-devicons' | " eye candy icons
11Plug 'mhinz/vim-signify' | " uses the sign column to indicate added, modified and removed lines
9 12
10" Brilliant_Plugins_by_tpope: ========================. 13" TESTING: | " plugins which I am currently trying...
11" Plug 'tpope/vim-sensible' | " a sane and modern default configuration # not required with nvim 14" Plug 'rkitover/vimpager'
12Plug 'tpope/vim-surround' | " plugin makes cs"' inside a line replace " with ' 15" Plug 'wting/gitsessions.vim' | " worth a try: restore sessions based on the git repo you are working in
13Plug 'tpope/vim-fugitive' | " the most complete GIT integration plugin 16" Plug 'Shougo/neocomplete.vim' | " alternative to YouCompleteMe in some cases
14Plug 'godlygeek/tabular' | " align code on a sign, like :Tab/= 17" Plug 'tpope/vim-characterize' | " normal mode: make ga show character names of Unicode chars (ga shows hex and dec values)
15Plug 'mhinz/vim-signify' | " show changes in the clutter bar
16Plug 'jlanzarotta/bufexplorer'
17" Plug 'wting/gitsessions.vim'
18Plug 'rkitover/vimpager'
19Plug 'mtth/scratch.vim'
20Plug 'airblade/vim-rooter' | " makes :lcd changes to projects (git-)root (code-completion, gf, grep, find)
21 18
22nnoremap <F12> :ToggleBufExplorer<CR> 19" Colorschemes:
20Plug 'chriskempson/base16-vim' | " not just one high quality color scheme (all named base16-*)
21
22" SCRATCH: | " Unobtrusive scratch window
23Plug 'mtth/scratch.vim'
23nnoremap <F2> :ScratchPreview<CR> 24nnoremap <F2> :ScratchPreview<CR>
24nnoremap <F6> :syntax sync fromstart<CR>:nohlsearch<CR>
25 25
26" VIM_ROOTER: | " Unobtrusive scratch window
27Plug 'airblade/vim-rooter' | " makes :lcd changes to projects (git-)root (code-completion, gf, grep, find)
28
29" BUFEXPLORER: | " a buffer to list all buffers has the advantage, that default /-searches work in there
30Plug 'jlanzarotta/bufexplorer'
31nnoremap <F12> :ToggleBufExplorer<CR>
32" autocmd BufEnter * lcd %:p:h | " Plugin vim-rooter get used instead (which is much more sane as well)
26 33
27" AIRLINE: ===========================================. 34" AIRLINE: a fancy status line =========================================================================================
28Plug 'vim-airline/vim-airline' | " beautification of the mode line 35Plug 'vim-airline/vim-airline' | " beautification of the mode line
29set laststatus=2 | " required by AirLine, without status line does not appear until a window split 36set laststatus=2 | " required by AirLine, without status line does not appear until a window split
30let g:airline_detect_modified = 0 | 37let g:airline_extensions = ['tabline', 'branch', 'syntastic', 'tagbar', 'whitespace', 'ycm']
31let g:airline_detect_paste = 0 | 38let b:airline_whitespace_checks = ['indent', 'trailing', 'long', 'mixed-indent-file']
32let g:airline_exclude_preview = 1 | 39let g:airline_section_c = "" | " was: %F
33let g:airline_extensions = ['tabline', 'branch', 'syntastic', 'tagbar'] 40let g:airline#extensions#tagbar#flags = 'f' | " even though the airline extension is off this controls :h tagbar-extend
34let g:airline#extensions#tabline#disable_refresh = 1 | 41let g:airline#extensions#tabline#left_sep = ' '
35let g:airline#extensions#tabline#enabled = 1 | 42let g:airline#extensions#tabline#left_alt_sep = ' | '
36let g:airline#extensions#tabline#fnamemod = ':t:.' | " let airline just show the filename without its path 43let g:airline#extensions#tabline#fnamemod = ':t:.' | " let airline just show the filename without its path
37let g:airline#extensions#tabline#show_buffers = 1 | 44let g:airline#extensions#tabline#disable_refresh = 1 |
38let g:airline#extensions#tabline#show_tabs = 0 | 45let g:airline#extensions#tabline#enabled = 1 |
39let g:airline#extensions#tagbar#enabled = 0 | 46let g:airline#extensions#tabline#show_buffers = 1 |
40let g:airline#extensions#tagbar#flags = 's' 47let g:airline#extensions#tabline#show_tabs = 0 |
41let g:airline#extensions#tagbar#currenttag = 'f' 48let g:airline#extensions#tagbar#enabled = 0 |
42let g:airline#extensions#whitespace#enabled = 0 | 49let g:airline#extensions#whitespace#enabled = 1 |
43let g:airline#extensions#wordcount#enabled = 0 | 50let g:airline#extensions#wordcount#enabled = 0 |
44let g:airline_inactive_collapse = 1 | 51let g:airline_detect_modified = 0 |
45let g:airline_powerline_fonts = 1 | 52let g:airline_detect_paste = 0 |
46let g:airline_section_c = '%F' 53let g:airline_exclude_preview = 0 |
47 54let g:airline_inactive_collapse = 1 |
48 55let g:airline_powerline_fonts = 1 |
49" AIRLINE_Theme: =====================================. 56" AIRLINE_Theme:
50Plug 'vim-airline/vim-airline-themes' | " airline themes to match any light and dark terminal using :AirlineTheme 57Plug 'vim-airline/vim-airline-themes' | " airline themes to match any light and dark terminal using :AirlineTheme
51let g:airline_theme='base16' | " specifies which colorscheme should airline uses 58let g:airline_theme='base16' | " specifies which colorscheme should airline uses
52" let g:airline_theme='badcat' | " specifies which colorscheme should airline uses 59" let g:airline_theme='badcat' | " specifies which colorscheme should airline uses
53" let g:airline_theme='papercolor' | " specifies which colorscheme should airline uses 60" let g:airline_theme='papercolor' | " specifies which colorscheme should ionirline uses
54 61
55 62
56" Colorschemes: ======================================. 63" NERDTree: replaces NetRW, as long as it has so many bugs
57Plug 'ryanoasis/vim-devicons' | " eye candy icons 64Plug 'scrooloose/nerdtree' | "
58Plug 'chriskempson/base16-vim' | " 65let NERDTreeCascadeSingleChildDir = 0 | " I don't get how one can use <m> to create files in that included directory
59map <leader>q :bp<bar>sp<bar>bn<bar>bd<CR>. 66let NERDTreeShowBookmarks = 1 | " show bookmarks by default (when opening for the first time)
60
61
62" NETRW: =============================================.
63let g:netrw_list_hide = '^\..*' | " Explore mode: hide files starting with dot
64let g:netrw_hide = 1 | " show not-hidden files only
65let g:netrw_liststyle = 3 | " 3=tree
66let g:netrw_banner = 0 | " display help messages?
67let g:netrw_winsize = 20 | " window size in percent
68let g:netrw_fastbrowse = 2 | " manually refresh direcory list (avoids display errors)
69let g:netrw_keepdir = 0
70let g:netrw_browse_split = 4 | " 4=open in previous window
71let g:netrw_preview = 0 | "
72let g:netrw_alto = 0 | " open files on the right
73let g:netrw_altv = 1 | " open files on the right
74
75" NERDTree: ==========================================.
76Plug 'scrooloose/nerdtree' | " replace NetRW, which is kind of buggy
77let NERDTreeCascadeSingleChildDir = 0 | " I don't get how one can use <m> to create files in that included directory
78let NERDTreeShowBookmarks = 1 | " show bookmarks by default (when opening for the first time)
79let NERDTreeIgnore = ['\.aux$'] 67let NERDTreeIgnore = ['\.aux$']
80set winwidth=30 " keep NERDTreeWindow at least this size
81set winminwidth=30 " (and all other windows, so TODO: watch out)
82 68
83" depending on if NERDTree has the focus: 69" depending on if NERDTree has the focus:
84nnoremap <expr> 70nnoremap <expr>
@@ -123,71 +109,71 @@ nnoremap <F9> :TagbarToggle<CR>| " bind TagBar to Hotkey Ct
123 109
124 110
125" Autocompleter: =====================================. 111" Autocompleter: =====================================.
126Plug 'Valloric/MatchTagAlways' " highlights the closing tag/brace/... 112Plug 'Valloric/MatchTagAlways' " highlights the closing tag/brace/...
127Plug 'Valloric/YouCompleteMe' 113Plug 'Valloric/YouCompleteMe'
128let g:ycm_add_preview_to_completeopt = 1 " reuse existing preview window 114let g:ycm_add_preview_to_completeopt = 1 " reuse existing preview window
129let g:ycm_autoclose_preview_window_after_insertion = 1 115let g:ycm_autoclose_preview_window_after_insertion = 1
130let g:ycm_collect_identifiers_from_tags_files = 1 " Let YCM read tags from Ctags file 116let g:ycm_collect_identifiers_from_tags_files = 1 " Let YCM read tags from Ctags file
131let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword 117let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword
132let g:ycm_complete_in_comments = 1 " Completion in comments 118let g:ycm_complete_in_comments = 1 " Completion in comments
133let g:ycm_complete_in_strings = 1 " Completion in string 119let g:ycm_complete_in_strings = 1 " Completion in string
134let g:ycm_error_symbol = '✖' " insert this as an error symbol in the gutter bar 120let g:ycm_error_symbol = '✖' " insert this as an error symbol in the gutter bar
135let g:ycm_min_num_of_chars_for_completion = 1 121let g:ycm_min_num_of_chars_for_completion = 1
136let g:ycm_use_ultisnips_completer = 1 " Default 1, just ensure 122let g:ycm_use_ultisnips_completer = 1 " Default 1, just ensure
137let g:ycm_warning_symbol = '➔' " insert this as a warning symbol in the gutter bar 123let g:ycm_warning_symbol = '➔' " insert this as a warning symbol in the gutter bar
138let g:ycm_confirm_extra_conf = 0 " security is overrated 124let g:ycm_confirm_extra_conf = 0 " security is overrated
139let g:ycm_key_list_select_completion = ['<Down>'] 125let g:ycm_key_list_select_completion = ['<Down>']
140let g:ycm_key_list_previous_completion = ['<Up>'] 126let g:ycm_key_list_previous_completion = ['<Up>']
141let g:ycm_global_ycm_extra_conf = '~/src/ycm_extra_conf.py' 127let g:ycm_global_ycm_extra_conf = '~/src/ycm_extra_conf.py'
142let g:ycm_semantic_triggers = { 'c': [ 're!.' ] } 128let g:ycm_semantic_triggers = { 'c': [ 're!.' ] }
143" 'cmake -D CMAKE_EXPORT_COMPILE_COMMANDS=1 ..' can be used to generate a .ycm-extra.conf compatible json file
144" disable <tab>-key for YCM so that it can be used with ultisnips 129" disable <tab>-key for YCM so that it can be used with ultisnips
145" let g:ycm_key_list_select_completion=[] 130" let g:ycm_key_list_select_completion=[]
146" let g:ycm_key_list_previous_completion=[] 131" let g:ycm_key_list_previous_completion=[]
147" Plug 'rdnetto/YCM-Generator' 132"
133" Plug 'rdnetto/YCM-Generator' " you better use cmake to generate json build commands, like:
134" 'cmake -D CMAKE_EXPORT_COMPILE_COMMANDS=1 ..' can be used to generate a .ycm-extra.conf compatible json file
148 135
149" Plug 'ervandew/supertab'
150 136
151 137
152Plug 'scrooloose/syntastic' 138Plug 'scrooloose/syntastic'
153set statusline+=%#warningmsg# 139set statusline+=%#warningmsg#
154set statusline+=%{SyntasticStatuslineFlag()} 140set statusline+=%{SyntasticStatuslineFlag()}
155set statusline+=%* 141" set statusline+=%*
156" set signcolumn=yes " always show the column 142set signcolumn=yes " always show the column
157let g:LatexBox_latexmk_preview_continuously = 1 143let g:LatexBox_latexmk_preview_continuously = 1
158let g:LatexBox_viewer = "evince" 144let g:LatexBox_viewer = "evince"
159let g:syntastic_always_populate_loc_list = 1 145let g:syntastic_always_populate_loc_list = 1
160let g:syntastic_auto_loc_list = 0 146let g:syntastic_auto_loc_list = 0
161let g:syntastic_check_on_open = 1 147let g:syntastic_check_on_open = 1
162let g:syntastic_check_on_wq = 0 148let g:syntastic_check_on_wq = 0
163let g:syntastic_quiet_messages = {"type":"style"} " filter ( = do not display) style/formatting errors and warnings 149let g:syntastic_quiet_messages = {"type":"style"}
164" Syntastic 150" filter ( = do not display) style/formatting errors and warnings
165let g:syntastic_error_symbol = '✖' 151let g:syntastic_error_symbol = '✖'
166let g:syntastic_style_error_symbol = '✗' 152let g:syntastic_style_error_symbol = '✗'
167let g:syntastic_warning_symbol = '➔' 153let g:syntastic_warning_symbol = '➔'
168let g:syntastic_style_warning_symbol = '≈' 154let g:syntastic_style_warning_symbol = '≈'
169 155
170Plug 'davidhalter/jedi-vim' " jedi gets used to display python function signatures 156Plug 'davidhalter/jedi-vim' " jedi gets used to display python function signatures
171let g:jedi#completions_enabled = 0 " we do not need completions, because we have YouCompleteMe 157let g:jedi#completions_enabled = 0 " we do not need completions, because we have YouCompleteMe
172let g:jedi#show_call_signatures = 1 " which sadly does not support signatures like jedi 158let g:jedi#show_call_signatures = 1 " which sadly does not support signatures like jedi
173let g:jedi#show_call_signatures_delay = 0 159let g:jedi#show_call_signatures_delay = 0
174let g:jedi#auto_vim_configure = 0 160let g:jedi#auto_vim_configure = 0
175let g:pymode_rope = 0 " https://github.com/davidhalter/jedi-vim/issues/163 161let g:pymode_rope = 0 " https://github.com/davidhalter/jedi-vim/issues/163
176" autocmd FileType python jedi.preload_module('os', 'sys', 'math') 162" autocmd FileType python jedi.preload_module('os', 'sys', 'math')
177" let g:pymode_options_max_line_length = 120 163" let g:pymode_options_max_line_length = 120
178" let g:syntastic_python_flake8_args='--ignore=F821,E302,E501,E241,E301' 164" let g:syntastic_python_flake8_args='--ignore=F821,E302,E501,E241,E301'
179 165
180Plug 'honza/vim-snippets' " dependency of ultisnips (see below) 166" ULTISNIPS: code snippet ==============================================================================================
181Plug 'SirVer/ultisnips' " replaces loremipsum (and many more) 167Plug 'honza/vim-snippets' " dependency of ultisnips (see below)
168Plug 'SirVer/ultisnips' " replaces loremipsum (and many more)
182"let g:UltiSnipsExpandTrigger = '<C-j>'| " Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe. 169"let g:UltiSnipsExpandTrigger = '<C-j>'| " Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
183"let g:UltiSnipsJumpForwardTrigger = '<C-j>'| " \ 170"let g:UltiSnipsJumpForwardTrigger = '<C-j>'| " \
184"let g:UltiSnipsJumpBackwardTrigger = '<C-k>'| " \ 171"let g:UltiSnipsJumpBackwardTrigger = '<C-k>'| " \
185"let g:UltiSnipsListSnippets = '<C-`>'| " YouCompleteMe includes those, so this isn't necessary 172"let g:UltiSnipsListSnippets = '<C-`>'| " YouCompleteMe includes those, so this isn't necessary
186" let g:UltiSnipsExpandTrigger = '<leader><tab>'| " Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe. 173"let g:UltiSnipsExpandTrigger = '<leader><tab>'| " Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
187" let g:UltiSnipsJumpForwardTrigger = '<PageDown>'| " \ 174"let g:UltiSnipsJumpForwardTrigger = '<PageDown>'| " \
188" let g:UltiSnipsJumpBackwardTrigger = '<PageUp>'| " \ 175"let g:UltiSnipsJumpBackwardTrigger = '<PageUp>'| " \
189" let g:UltiSnipsListSnippets = '<leader><leader>'| " YouCompleteMe includes those, so this isn't necessary 176"let g:UltiSnipsListSnippets = '<leader><leader>'| " YouCompleteMe includes those, so this isn't necessary
190
191" UltiSnips triggering 177" UltiSnips triggering
192" let g:UltiSnipsExpandTrigger = "<nop>" 178" let g:UltiSnipsExpandTrigger = "<nop>"
193" let g:ulti_expand_or_jump_res = 0 179" let g:ulti_expand_or_jump_res = 0
@@ -201,63 +187,42 @@ Plug 'SirVer/ultisnips' " replaces loremipsum (and
201" endfunction 187" endfunction
202" inoremap <expr> <CR> pumvisible() ? "\<C-R>=ExpandSnippetOrCarriageReturn()\<CR>" : "\<CR>" 188" inoremap <expr> <CR> pumvisible() ? "\<C-R>=ExpandSnippetOrCarriageReturn()\<CR>" : "\<CR>"
203" set completeopt-=preview 189" set completeopt-=preview
204
205" let g:UltiSnipsEditSplit = 'vertical' 190" let g:UltiSnipsEditSplit = 'vertical'
206 191
207 192
208" Disabled ===========================================.
209" Plug 'Shougo/neocomplete.vim' | " alternative to YouCompleteMe in some cases
210" Plug 'tpope/vim-characterize' | " normal mode: make ga show character names of Unicode chars (ga shows hex and dec values)
211" Plug 'tpope/vim-repeat' | " lets . (dot) repeat plugin macros as well, specifically vim-surround
212
213 193
214call plug#end() | " all plugins are getting loaded on this line, don't remove! 194call plug#end() | " all plugins are getting loaded on this line, don't remove!
195" ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
196" END: LOADING PLUGINS
197
215 198
199"=======================================================================================================================
200" GENERAL:
201"=======================================================================================================================
216filetype on 202filetype on
217filetype plugin on 203filetype plugin on
218filetype indent on 204filetype indent on
205
219syntax on | " enable syntax highlighting 206syntax on | " enable syntax highlighting
220syntax sync minlines=60 | " how many preceding lines will be parsed? (has performance impact) 207syntax sync minlines=60 | " how many preceding lines will be parsed? (has performance impact)
221" set term=xtermc | " required on solaris
222
223
224
225" Shortcut mods =======================================.
226inoremap <C-Space> <C-x><C-o>
227"inoremap <C-@> <C-Space>
228vnoremap < <gv| " allows deindenting a selected block and keeps selection
229vnoremap > >gv| " allows indenting a selected block and keeps selection
230
231
232" Bind CTRL+Backspace to vims version (CTRL+W) in " <CR> insert mode (only works with gvim)
233inoremap
234 \ <C-Backspace>
235 \ <C-W>
236
237noremap <silent> <F5> :make<CR>
238
239" default copy&paste insert key binding (just in insert mode, so it doesn't conflict
240" with visual block mode).
241inoremap <C-V> <C-R>+
242inoremap <C-S> <C-O>:w<CR>
243
244
245 208
209"=======================================================================================================================
210" SPELL_CHECKING:
211"=======================================================================================================================
212set spell | " enable spell checker
213set spelllang=en,de | " languages for the spell checker
214set spellsuggest=10 | " how many words will z= suggest?
215set thesaurus+=/home/max/.vim/thesaurus/php.txt
216let g:spellfile_URL='http://ftp.vim.org/vim/runtime/spell'
246 217
247" spell checkers?
248set spell spelllang=en,de | " enable spell checker
249set dictionary=/usr/share/dict/cracklib-small 218set dictionary=/usr/share/dict/cracklib-small
250set complete+=k " make default completer <C-N> respect the dictionary 219set complete+=k " make default completer <C-N> respect the dictionary
251 220
252let g:spellfile_URL = 'http://ftp.vim.org/vim/runtime/spell' 221"=======================================================================================================================
253 222" SETTINGS:
254" settings ============================================. 223"=======================================================================================================================
255" 224set noautochdir | " When on, Vim will change the current working directory
256" autocmd BufEnter * lcd %:p:h
257" set autochdir | " When on, Vim will change the current working directory
258set shell=/bin/bash | " many scripts rely on bash, but its path varies why it is commented out here 225set shell=/bin/bash | " many scripts rely on bash, but its path varies why it is commented out here
259" set selectmode=mouse,key,cmd | " enters vim's select mode when pressing shift-left or shift-END
260" set keymodel=startsel,stopsel | " makes shift-left, shift-right available for selecting text
261set breakindent | " Every wrapped line will continue visually indented 226set breakindent | " Every wrapped line will continue visually indented
262set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well) 227set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well)
263set cmdheight=2 | " sets the command line's height 228set cmdheight=2 | " sets the command line's height
@@ -293,53 +258,71 @@ set redrawtime=400 | " The time in milliseconds for redrawing the dis
293set scrolljump=5 | " how many lines get scrolled into view when cursor reaches the screens edge 258set scrolljump=5 | " how many lines get scrolled into view when cursor reaches the screens edge
294set splitbelow | " open new windows below the current one (i find that more intuitive) 259set splitbelow | " open new windows below the current one (i find that more intuitive)
295set shiftround | " indent/unindent snaps to multiple of shiftwidth 260set shiftround | " indent/unindent snaps to multiple of shiftwidth
296set showcmd | " essential: show keys of combined commands in the lower right corner 261" set showcmd | " essential: show keys of combined commands in the lower right corner (BUT SLOW, makes cursor flickering)
262set noshowcmd | " essential: show keys of combined commands in the lower right corner (BUT SLOW, makes cursor flickering)
263set winwidth=30 | " keep NERDTreeWindow at least this size
264set winminwidth=30 | " (and all other windows, so TODO: watch out)
297set tags+=../tags 265set tags+=../tags
298set t_Co=256 | " required on some ssh sessions
299" set textwidth=100 | " line length (80 used to be default, but...) 266" set textwidth=100 | " line length (80 used to be default, but...)
300set textwidth=120 | " better done with modeline 267set textwidth=120 | " better done with modeline
301set colorcolumn=120 | " better done with modeline 268set colorcolumn=120 | " better done with modeline
302set thesaurus+=/home/max/.vim/thesaurus/php.txt
303set ts=4 sts=4 sw=4 expandtab | " better done with a modeline 269set ts=4 sts=4 sw=4 expandtab | " better done with a modeline
304set ttimeoutlen=10 | " set esc key timeout in ms- 270set ttimeoutlen=10 | " set esc key timeout in ms-
305set updatetime=1000 | " updates the screen more often 271set updatetime=1000 | " updates the screen more often
306set writedelay=0 272set writedelay=0
307set lcs+=space:· | " local space char 273set lcs+=space:· | " local space char
274"=======================================================================================================================
275" COLORSCHEME:
276" set term=xtermc | " may be required on solaris
277set t_Co=256 | " required on some ssh sessions
278let &t_Co=256
279set background=light | " hint how the terminal background looks like
308 280
309if has("multi_byte") 281" set termguicolors
310 scriptencoding utf-8 | " tell vim that we are using utf-8 here 282let base16colorspace=256
311 set encoding=utf-8 | " we need default utf-8 encoding to use cool chars as line break and so on (see below) 283if filereadable(expand("~/.vimrc_background"))
312 set termencoding=&encoding | " once we use special chars we assume everybody uses a terminal supporting those 284 source ~/.vimrc_background
313 285else
314 set listchars= | " initialize empty listchars 286 colorscheme base16-phd
315 set listchars+=extends:» | " symbols used when using :set list (which displays non-printable chars) 287" colorscheme base16-embers
316 set listchars+=precedes:« | " symbols used when using :set list (which displays non-printable chars) 288" colorscheme base16-flat
317 289" colorscheme base16-summerfruit-dark
318 set listchars+=tab:⮁\ | " symbols used when using :set list (which displays non-printable chars) 290" colorscheme base16-tommorow
319 set listchars+=trail:· | " symbols used when using :set list (which displays non-printable chars) 291" colorscheme base16-default-dark
320 " set listchars+=eol:↲ | " symbols used when using :set list (which displays non-printable chars) 292endif
321 " set listchars+=space:· | " symbols used when using :set list (which displays non-printable chars)
322 set showbreak+=› | " symbol used in the beginning of a wrapped line
323 set list
324end
325 293
326if has("gui_running") 294highlight normal ctermbg=NONE | " uses the default terminal background color as background (allows transparency)
327 set toolbar+=text 295highlight CursorLineNr ctermbg=black ctermfg=NONE
328 set guioptions+=eig 296
329 set guioptions-=T | " toolbar 297
330 set guioptions+=c | " use console dialogs instead of popups 298highlight Cursor guibg=green
331 set guioptions+=a | " autoselect: copy&paste using middleclick 299" let &t_EI .= "\<Esc>[0 q"
332 set guioptions-=m | " remove menu 300" let &t_SI = "\<Esc>]12;green\x7"
333 " set guifont=Droid\ Sans\ Mono\ for\ Powerline\ 12 301if has('autocmd')
334 set guifont=Dejavu\ Sans\ Mono\ for\ Powerline\ 12 302 autocmd VimEnter * let &t_EI .= "\<Esc>[0 q"
335 set guioptions-=e | " do not display tabs 303 autocmd VimEnter * let &t_SI = "\<Esc>]12;black\x7"
336 set guioptions-=L | " do not show left scrollbar 304 autocmd VimLeave * silent !echo -ne "\033]112\007"
337 set guioptions-=r | " do not show right scrollbar
338 set winaltkeys=menu | " behave like other windows: ALT-key can be used to open the menu (and cannot be :remaped)
339endif 305endif
340 306
307"=======================================================================================================================
308if has("multi_byte")
309 scriptencoding utf-8 | " tell vim that we are using utf-8 here
310 set encoding=utf-8 | " we need default utf-8 encoding to use cool chars as line break and so on (see below)
311 set termencoding=&encoding | " once we use special chars we assume everybody uses a terminal supporting those
312
313 set listchars= | " initialize empty listchars
314 set listchars+=extends:» | " symbols used when using :set list (which displays non-printable chars)
315 set listchars+=precedes:« | " symbols used when using :set list (which displays non-printable chars)
316
317 set listchars+=tab:˲\ | " symbols used when using :set list (which displays non-printable chars)
318 set listchars+=trail:· | " symbols used when using :set list (which displays non-printable chars)
319 " set listchars+=eol:↲ | " symbols used when using :set list (which displays non-printable chars)
320 " set listchars+=space:· | " symbols used when using :set list (which displays non-printable chars)
321 set showbreak+=› | " symbol used in the beginning of a wrapped line
322 set list
323end
341 324
342if has('cscope') 325if has('cscope') " compiled with cscope support?
343 " http://vim.wikia.com/wiki/Cscope 326 " http://vim.wikia.com/wiki/Cscope
344 set cscopetag cscopeverbose 327 set cscopetag cscopeverbose
345 328
@@ -354,15 +337,34 @@ if has('cscope')
354 cnoreabbrev css cs show 337 cnoreabbrev css cs show
355 cnoreabbrev csh cs help 338 cnoreabbrev csh cs help
356 339
357 command -nargs=0 Cscope cs add $VIMSRC/src/cscope.out $VIMSRC/src 340 command! -nargs=0 Cscope cs add $VIMSRC/src/cscope.out $VIMSRC/src
358endif 341endif
359
360 342
361if bufname('%') == '' 343" GUI_VERSION:
362 set bufhidden=wipe 344if has("gui_running")
345 set toolbar+=text
346 set guioptions+=eig
347 set guioptions-=T | " toolbar
348 set guioptions+=c | " use console dialogs instead of popups
349 set guioptions+=a | " autoselect: copy&paste using middleclick
350 set guioptions-=m | " remove menu
351 set guioptions-=e | " do not display tabs
352 set guioptions-=L | " do not show left scrollbar
353 set guioptions-=r | " do not show right scrollbar
354 set winaltkeys=menu | " behave like other windows: ALT-key can be used to open the menu (and cannot be :remaped)
355 set guifont=Dejavu\ Sans\ Mono\ for\ Powerline\ 12
356 " set guifont=Droid\ Sans\ Mono\ for\ Powerline\ 12
357" set selectmode=mouse,key,cmd | " enters vim's select mode when pressing shift-left or shift-END
358" set keymodel=startsel,stopsel | " makes shift-left, shift-right available for selecting text
363endif 359endif
364 360
365" noautocmd 361" NEOVIM_incompatible:
362if !has('nvim') | " settings which have been removed from neovim
363 set ttymouse=xterm2
364 set ttyscroll=100 | " improves speed for terminal vim, incomp. with nvim
365 set ttyfast | " improves speed for terminal vim (incomp. with nvim)
366 " set termguicolors | " When on, uses highlight-guifg and highlight-guibg attributes in the terminal (=24bit color) incomp. with nvim
367endif
366 368
367if has("autocmd") 369if has("autocmd")
368 set modeline | " set variables specific to a file, like indentation by adding a comment 370 set modeline | " set variables specific to a file, like indentation by adding a comment
@@ -370,15 +372,14 @@ if has("autocmd")
370 set omnifunc=syntaxcomplete#Complete 372 set omnifunc=syntaxcomplete#Complete
371 373
372 " automatically reload this file when it gets edited 374 " automatically reload this file when it gets edited
373 augroup reload_vimrc " { 375 if !exists("*OnConfigChange")
374 autocmd! 376 function OnConfigChange()
375 autocmd BufWritePost $MYVIMRC source $MYVIMRC 377 autocmd! |" Remove all vimrc autocommands
376 augroup END " } 378 source $MYVIMRC
377 379 AirlineRefresh
378 augroup extra_whitespace " { 380 endfunction
379 highlight ExtraWhitespace ctermbg=red guibg=red 381 autocmd BufWritePost $MYVIMRC call OnConfigChange()
380 syn match ExtraWhitespace /\s\+$/ 382 endif
381 augroup END "}
382 383
383 augroup set_window_title " { 384 augroup set_window_title " {
384 " autocmd BufWinEnter quickfix setl statusline=%t 385 " autocmd BufWinEnter quickfix setl statusline=%t
@@ -398,21 +399,6 @@ if has("autocmd")
398 endif 399 endif
399 augroup END 400 augroup END
400 401
401 augroup visual_mode_shows_unprintable " {
402 " set cursorline | " use setcursorline in order to highlight non printable chars in the current line
403 autocmd ColorScheme * highlight normal ctermbg=NONE
404 " set list | " shows unprinable characters in the current line
405 " autocmd ColorScheme * highlight NonText ctermbg=NONE ctermfg=0 gui=bold guifg=NONE
406 " autocmd ColorScheme * highlight SpecialKey ctermbg=NONE ctermfg=0 gui=bold guifg=NONE
407 " autocmd ColorScheme * highlight CursorLineNr term=bold ctermbg=NONE ctermfg=0 gui=bold guifg=Yellow
408 "
409 "
410 " highlight NonText guifg=#1d1f21 | " make non printable chars invisible. The active line is an exception.
411 " highlight ColorColumn guibg=#005f87
412 " highlight ColorColumn guibg=#F0F0E0
413 augroup END " }
414
415
416 " hitting K over a keyword shows a help in a buffer. 402 " hitting K over a keyword shows a help in a buffer.
417 " Here we define the commands used to look those keywords up 403 " Here we define the commands used to look those keywords up
418 " as per file type... 404 " as per file type...
@@ -439,11 +425,6 @@ if has("autocmd")
439 augroup END 425 augroup END
440 426
441 427
442 augroup ChangeCursor
443 autocmd VimEnter * let &t_EI .= "\<Esc>[0 q"
444 autocmd VimEnter * let &t_SI = "\<Esc>]12;yellow\x7"
445 autocmd VimLeave * silent !echo -ne "\033]112\007"
446 augroup END
447 428
448 augroup ChangeIcon 429 augroup ChangeIcon
449 "if filereadable("/usr/bin/xseticon") 430 "if filereadable("/usr/bin/xseticon")
@@ -491,63 +472,96 @@ if has("autocmd")
491 nmap <script> <silent> <F4> :call QFixToggle(0)<CR> 472 nmap <script> <silent> <F4> :call QFixToggle(0)<CR>
492 augroup END 473 augroup END
493 474
494 "set omnifunc=syntaxcomplete#Complete
495 " au BufNewFile,BufRead,BufEnter *.cpp,*.hpp set omnifunc=omni#cpp#complete#Main
496 " Enable omni completion.
497 " autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
498 " autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
499 " auto complete closing tag name when entering </-[space]
500 " autocmd Filetype html,markdown,xml iabbrev </ </<C-X><C-O>
501 " autocmd FileType python setlocal omnifunc=jedi#completions
502 " following autocommands are there to call neovim functions...
503 " autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
504 " autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
505 " autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
506 " " Enable heavy omni completion.
507 " if !exists('g:neocomplete#sources#omni#input_patterns')
508 " let g:neocomplete#sources#omni#input_patterns = {}
509 " endif
510endif
511 475
512let &t_Co=256 476 augroup extra_whitespace " {
513set background=dark 477 highlight ExtraWhitespace ctermbg=red guibg=red
514" set termguicolors 478 autocmd BufEnter * syn match ExtraWhitespace /\s\+$/
515let base16colorspace=256 479 augroup END "}
516if filereadable(expand("~/.vimrc_background"))
517 source ~/.vimrc_background
518else
519 colorscheme base16-phd
520endif
521 480
481 augroup CurrentFileName
482 highlight CurrentFileName ctermbg=yellow guibg=yellow
522 483
523highlight ExtraWhitespace ctermbg=red guibg=red 484 " highlight the current files name inside the document...
524syn match ExtraWhitespace /\s\+$/ 485 let @g = ":exe ':match CurrentFileName /'.escape(expand('%:t'), '.').'/'"
486 " put the current files name after the cursor...
487 let @f = ":exe ':normal a'.expand('%:t')"
525 488
489 " autocmd BufEnter * @f
490 augroup END
526 491
527if !has('nvim') 492 if bufname('%') == ''
528 set ttymouse=xterm2 493 set bufhidden=wipe
529 set ttyscroll=100 | " improves speed for terminal vim, incomp. with nvim 494 endif
530 set ttyfast | " improves speed for terminal vim (incomp. with nvim)
531 " set termguicolors | " When on, uses highlight-guifg and highlight-guibg attributes in the terminal (=24bit color) incomp. with nvim
532else
533 " shortcut \t opens a terminal in a horizontal split
534 nnoremap <leader>t :new +terminal<CR>
535endif 495endif
536 496
537nnoremap <leader>r :syntax sync fromstart
538 497
539" colorscheme base16-embers 498" ======================================================================================================================
540" colorscheme base16-flat 499" SHORTCUTS: custom shortcuts
541" colorscheme base16-summerfruit-dark 500inoremap <C-Space> <C-x><C-o>
542" colorscheme base16-tommorow 501"inoremap <C-@> <C-Space>
543" colorscheme base16-default-dark
544 502
503" Bind CTRL+Backspace to vims version (CTRL+W) in " <CR> insert mode (only works with gvim)
504inoremap
505 \ <C-Backspace>
506 \ <C-W>
507
508" INDENTATION: allows deindenting a selected block and keeps selection
509vnoremap < <gv
510vnoremap > >gv
545 511
546" colorscheme customizations ========================= 512" close current buffer with <leader>q...
547" override colorscheme's background color in order to honor the terminals background transparency 513nnoremap <leader>q :bp<bar>sp<bar>bn<bar>bd<CR>.
548 514
515nnoremap <silent> <F5> :make<CR>
516nnoremap <silent> <F6> :silent syntax sync fromstart<CR>:nohlsearch<CR>:silent match<CR>
517nnoremap <leader>r :syntax sync fromstart
549 518
550 519
520" INSERT_MODE_MAPPINGS:
521" default copy&paste insert key binding (just in insert mode, so it doesn't conflict
522" with visual block mode).
523inoremap <C-V> <C-R>+
524inoremap <C-S> <C-O>:w<CR>
525
526" NEOVIM_SPECIFIC:
527if has('nvim') " only neovim...
528 " shortcut \t opens a terminal in a horizontal split
529 nnoremap <leader>t :new +terminal<CR>
530endif
531
532" ======================================================================================================================
533" Deprecated with this configuration, but still useful when deactivating some Plugins
534
535" NETRW: obsolete with NERDTree
536let g:netrw_alto = 0 | " open files on the right
537let g:netrw_altv = 1 | " open files on the right
538let g:netrw_banner = 0 | " display help messages?
539let g:netrw_browse_split = 4 | " 4=open in previous window
540let g:netrw_fastbrowse = 2 | " manually refresh direcory list (avoids display errors)
541let g:netrw_hide = 1 | " show not-hidden files only
542let g:netrw_keepdir = 0
543let g:netrw_list_hide = '^\..*' | " Explore mode: hide files starting with dot
544let g:netrw_liststyle = 3 | " 3=tree
545let g:netrw_preview = 0 | "
546let g:netrw_winsize = 20 | " window size in percent
547
548
549"set omnifunc=syntaxcomplete#Complete
550" au BufNewFile,BufRead,BufEnter *.cpp,*.hpp set omnifunc=omni#cpp#complete#Main
551" Enable omni completion.
552" autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
553" autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
554" auto complete closing tag name when entering </-[space]
555" autocmd Filetype html,markdown,xml iabbrev </ </<C-X><C-O>
556" autocmd FileType python setlocal omnifunc=jedi#completions
557" following autocommands are there to call neovim functions...
558" autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
559" autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
560" autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
561" " Enable heavy omni completion.
562" if !exists('g:neocomplete#sources#omni#input_patterns')
563" let g:neocomplete#sources#omni#input_patterns = {}
564" endif
551" if filereadable(expand("~/.vimrc_background")) 565" if filereadable(expand("~/.vimrc_background"))
552" let base16colorspace=256 566" let base16colorspace=256
553" source ~/.vimrc_background 567" source ~/.vimrc_background
@@ -567,11 +581,3 @@ nnoremap <leader>r :syntax sync fromstart
567" \ 'separator': { 'left': "\ue0b0", 'right': "\ue0b2" }, 581" \ 'separator': { 'left': "\ue0b0", 'right': "\ue0b2" },
568" \ 'subseparator': { 'left': "\ue0b1", 'right': "\ue0b3" } 582" \ 'subseparator': { 'left': "\ue0b1", 'right': "\ue0b3" }
569" \ } 583" \ }
570" Plug 'fholgado/minibufexpl.vim'
571" let g:miniBufExplAutoStart = 1
572" let g:miniBufExplBRSplit = 1
573" let g:miniBufExplShowBufNumbers = 0
574" let g:miniBufExplSplitToEdge = 1
575" let g:miniBufExplVSplit = 20 " column width in chars
576
577
..