diff options
-rw-r--r-- | vimrc | 534 |
1 files changed, 270 insertions, 264 deletions
@@ -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 | " | ||
3 | if has('nvim') | ||
4 | runtime! python_setup.vim | ||
5 | endif | ||
6 | 2 | ||
3 | " START: LOADING PLUGINS | ||
4 | " ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ | ||
7 | call plug#begin() | 5 | call plug#begin() |
8 | 6 | ||
7 | Plug 'tpope/vim-surround' | " plugin makes cs"' inside a line replace " with ' | ||
8 | Plug 'tpope/vim-fugitive' | " the most complete GIT integration plugin | ||
9 | Plug 'godlygeek/tabular' | " align code on a sign, like :Tab/= | ||
10 | Plug 'ryanoasis/vim-devicons' | " eye candy icons | ||
11 | Plug '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' |
12 | Plug '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 |
13 | Plug 'tpope/vim-fugitive' | " the most complete GIT integration plugin | 16 | " Plug 'Shougo/neocomplete.vim' | " alternative to YouCompleteMe in some cases |
14 | Plug '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) |
15 | Plug 'mhinz/vim-signify' | " show changes in the clutter bar | ||
16 | Plug 'jlanzarotta/bufexplorer' | ||
17 | " Plug 'wting/gitsessions.vim' | ||
18 | Plug 'rkitover/vimpager' | ||
19 | Plug 'mtth/scratch.vim' | ||
20 | Plug 'airblade/vim-rooter' | " makes :lcd changes to projects (git-)root (code-completion, gf, grep, find) | ||
21 | 18 | ||
22 | nnoremap <F12> :ToggleBufExplorer<CR> | 19 | " Colorschemes: |
20 | Plug 'chriskempson/base16-vim' | " not just one high quality color scheme (all named base16-*) | ||
21 | |||
22 | " SCRATCH: | " Unobtrusive scratch window | ||
23 | Plug 'mtth/scratch.vim' | ||
23 | nnoremap <F2> :ScratchPreview<CR> | 24 | nnoremap <F2> :ScratchPreview<CR> |
24 | nnoremap <F6> :syntax sync fromstart<CR>:nohlsearch<CR> | ||
25 | 25 | ||
26 | " VIM_ROOTER: | " Unobtrusive scratch window | ||
27 | Plug '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 | ||
30 | Plug 'jlanzarotta/bufexplorer' | ||
31 | nnoremap <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 ========================================================================================= |
28 | Plug 'vim-airline/vim-airline' | " beautification of the mode line | 35 | Plug 'vim-airline/vim-airline' | " beautification of the mode line |
29 | set laststatus=2 | " required by AirLine, without status line does not appear until a window split | 36 | set laststatus=2 | " required by AirLine, without status line does not appear until a window split |
30 | let g:airline_detect_modified = 0 | | 37 | let g:airline_extensions = ['tabline', 'branch', 'syntastic', 'tagbar', 'whitespace', 'ycm'] |
31 | let g:airline_detect_paste = 0 | | 38 | let b:airline_whitespace_checks = ['indent', 'trailing', 'long', 'mixed-indent-file'] |
32 | let g:airline_exclude_preview = 1 | | 39 | let g:airline_section_c = "" | " was: %F |
33 | let g:airline_extensions = ['tabline', 'branch', 'syntastic', 'tagbar'] | 40 | let g:airline#extensions#tagbar#flags = 'f' | " even though the airline extension is off this controls :h tagbar-extend |
34 | let g:airline#extensions#tabline#disable_refresh = 1 | | 41 | let g:airline#extensions#tabline#left_sep = ' ' |
35 | let g:airline#extensions#tabline#enabled = 1 | | 42 | let g:airline#extensions#tabline#left_alt_sep = ' | ' |
36 | let g:airline#extensions#tabline#fnamemod = ':t:.' | " let airline just show the filename without its path | 43 | let g:airline#extensions#tabline#fnamemod = ':t:.' | " let airline just show the filename without its path |
37 | let g:airline#extensions#tabline#show_buffers = 1 | | 44 | let g:airline#extensions#tabline#disable_refresh = 1 | |
38 | let g:airline#extensions#tabline#show_tabs = 0 | | 45 | let g:airline#extensions#tabline#enabled = 1 | |
39 | let g:airline#extensions#tagbar#enabled = 0 | | 46 | let g:airline#extensions#tabline#show_buffers = 1 | |
40 | let g:airline#extensions#tagbar#flags = 's' | 47 | let g:airline#extensions#tabline#show_tabs = 0 | |
41 | let g:airline#extensions#tagbar#currenttag = 'f' | 48 | let g:airline#extensions#tagbar#enabled = 0 | |
42 | let g:airline#extensions#whitespace#enabled = 0 | | 49 | let g:airline#extensions#whitespace#enabled = 1 | |
43 | let g:airline#extensions#wordcount#enabled = 0 | | 50 | let g:airline#extensions#wordcount#enabled = 0 | |
44 | let g:airline_inactive_collapse = 1 | | 51 | let g:airline_detect_modified = 0 | |
45 | let g:airline_powerline_fonts = 1 | | 52 | let g:airline_detect_paste = 0 | |
46 | let g:airline_section_c = '%F' | 53 | let g:airline_exclude_preview = 0 | |
47 | 54 | let g:airline_inactive_collapse = 1 | | |
48 | 55 | let g:airline_powerline_fonts = 1 | | |
49 | " AIRLINE_Theme: =====================================. | 56 | " AIRLINE_Theme: |
50 | Plug 'vim-airline/vim-airline-themes' | " airline themes to match any light and dark terminal using :AirlineTheme | 57 | Plug 'vim-airline/vim-airline-themes' | " airline themes to match any light and dark terminal using :AirlineTheme |
51 | let g:airline_theme='base16' | " specifies which colorscheme should airline uses | 58 | let 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 |
57 | Plug 'ryanoasis/vim-devicons' | " eye candy icons | 64 | Plug 'scrooloose/nerdtree' | " |
58 | Plug 'chriskempson/base16-vim' | " | 65 | let NERDTreeCascadeSingleChildDir = 0 | " I don't get how one can use <m> to create files in that included directory |
59 | map <leader>q :bp<bar>sp<bar>bn<bar>bd<CR>. | 66 | let NERDTreeShowBookmarks = 1 | " show bookmarks by default (when opening for the first time) |
60 | |||
61 | |||
62 | " NETRW: =============================================. | ||
63 | let g:netrw_list_hide = '^\..*' | " Explore mode: hide files starting with dot | ||
64 | let g:netrw_hide = 1 | " show not-hidden files only | ||
65 | let g:netrw_liststyle = 3 | " 3=tree | ||
66 | let g:netrw_banner = 0 | " display help messages? | ||
67 | let g:netrw_winsize = 20 | " window size in percent | ||
68 | let g:netrw_fastbrowse = 2 | " manually refresh direcory list (avoids display errors) | ||
69 | let g:netrw_keepdir = 0 | ||
70 | let g:netrw_browse_split = 4 | " 4=open in previous window | ||
71 | let g:netrw_preview = 0 | " | ||
72 | let g:netrw_alto = 0 | " open files on the right | ||
73 | let g:netrw_altv = 1 | " open files on the right | ||
74 | |||
75 | " NERDTree: ==========================================. | ||
76 | Plug 'scrooloose/nerdtree' | " replace NetRW, which is kind of buggy | ||
77 | let NERDTreeCascadeSingleChildDir = 0 | " I don't get how one can use <m> to create files in that included directory | ||
78 | let NERDTreeShowBookmarks = 1 | " show bookmarks by default (when opening for the first time) | ||
79 | let NERDTreeIgnore = ['\.aux$'] | 67 | let NERDTreeIgnore = ['\.aux$'] |
80 | set winwidth=30 " keep NERDTreeWindow at least this size | ||
81 | set 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: |
84 | nnoremap <expr> | 70 | nnoremap <expr> |
@@ -123,71 +109,71 @@ nnoremap <F9> :TagbarToggle<CR>| " bind TagBar to Hotkey Ct | |||
123 | 109 | ||
124 | 110 | ||
125 | " Autocompleter: =====================================. | 111 | " Autocompleter: =====================================. |
126 | Plug 'Valloric/MatchTagAlways' " highlights the closing tag/brace/... | 112 | Plug 'Valloric/MatchTagAlways' " highlights the closing tag/brace/... |
127 | Plug 'Valloric/YouCompleteMe' | 113 | Plug 'Valloric/YouCompleteMe' |
128 | let g:ycm_add_preview_to_completeopt = 1 " reuse existing preview window | 114 | let g:ycm_add_preview_to_completeopt = 1 " reuse existing preview window |
129 | let g:ycm_autoclose_preview_window_after_insertion = 1 | 115 | let g:ycm_autoclose_preview_window_after_insertion = 1 |
130 | let g:ycm_collect_identifiers_from_tags_files = 1 " Let YCM read tags from Ctags file | 116 | let g:ycm_collect_identifiers_from_tags_files = 1 " Let YCM read tags from Ctags file |
131 | let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword | 117 | let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword |
132 | let g:ycm_complete_in_comments = 1 " Completion in comments | 118 | let g:ycm_complete_in_comments = 1 " Completion in comments |
133 | let g:ycm_complete_in_strings = 1 " Completion in string | 119 | let g:ycm_complete_in_strings = 1 " Completion in string |
134 | let g:ycm_error_symbol = '✖' " insert this as an error symbol in the gutter bar | 120 | let g:ycm_error_symbol = '✖' " insert this as an error symbol in the gutter bar |
135 | let g:ycm_min_num_of_chars_for_completion = 1 | 121 | let g:ycm_min_num_of_chars_for_completion = 1 |
136 | let g:ycm_use_ultisnips_completer = 1 " Default 1, just ensure | 122 | let g:ycm_use_ultisnips_completer = 1 " Default 1, just ensure |
137 | let g:ycm_warning_symbol = '➔' " insert this as a warning symbol in the gutter bar | 123 | let g:ycm_warning_symbol = '➔' " insert this as a warning symbol in the gutter bar |
138 | let g:ycm_confirm_extra_conf = 0 " security is overrated | 124 | let g:ycm_confirm_extra_conf = 0 " security is overrated |
139 | let g:ycm_key_list_select_completion = ['<Down>'] | 125 | let g:ycm_key_list_select_completion = ['<Down>'] |
140 | let g:ycm_key_list_previous_completion = ['<Up>'] | 126 | let g:ycm_key_list_previous_completion = ['<Up>'] |
141 | let g:ycm_global_ycm_extra_conf = '~/src/ycm_extra_conf.py' | 127 | let g:ycm_global_ycm_extra_conf = '~/src/ycm_extra_conf.py' |
142 | let g:ycm_semantic_triggers = { 'c': [ 're!.' ] } | 128 | let 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 | ||
152 | Plug 'scrooloose/syntastic' | 138 | Plug 'scrooloose/syntastic' |
153 | set statusline+=%#warningmsg# | 139 | set statusline+=%#warningmsg# |
154 | set statusline+=%{SyntasticStatuslineFlag()} | 140 | set statusline+=%{SyntasticStatuslineFlag()} |
155 | set statusline+=%* | 141 | " set statusline+=%* |
156 | " set signcolumn=yes " always show the column | 142 | set signcolumn=yes " always show the column |
157 | let g:LatexBox_latexmk_preview_continuously = 1 | 143 | let g:LatexBox_latexmk_preview_continuously = 1 |
158 | let g:LatexBox_viewer = "evince" | 144 | let g:LatexBox_viewer = "evince" |
159 | let g:syntastic_always_populate_loc_list = 1 | 145 | let g:syntastic_always_populate_loc_list = 1 |
160 | let g:syntastic_auto_loc_list = 0 | 146 | let g:syntastic_auto_loc_list = 0 |
161 | let g:syntastic_check_on_open = 1 | 147 | let g:syntastic_check_on_open = 1 |
162 | let g:syntastic_check_on_wq = 0 | 148 | let g:syntastic_check_on_wq = 0 |
163 | let g:syntastic_quiet_messages = {"type":"style"} " filter ( = do not display) style/formatting errors and warnings | 149 | let g:syntastic_quiet_messages = {"type":"style"} |
164 | " Syntastic | 150 | " filter ( = do not display) style/formatting errors and warnings |
165 | let g:syntastic_error_symbol = '✖' | 151 | let g:syntastic_error_symbol = '✖' |
166 | let g:syntastic_style_error_symbol = '✗' | 152 | let g:syntastic_style_error_symbol = '✗' |
167 | let g:syntastic_warning_symbol = '➔' | 153 | let g:syntastic_warning_symbol = '➔' |
168 | let g:syntastic_style_warning_symbol = '≈' | 154 | let g:syntastic_style_warning_symbol = '≈' |
169 | 155 | ||
170 | Plug 'davidhalter/jedi-vim' " jedi gets used to display python function signatures | 156 | Plug 'davidhalter/jedi-vim' " jedi gets used to display python function signatures |
171 | let g:jedi#completions_enabled = 0 " we do not need completions, because we have YouCompleteMe | 157 | let g:jedi#completions_enabled = 0 " we do not need completions, because we have YouCompleteMe |
172 | let g:jedi#show_call_signatures = 1 " which sadly does not support signatures like jedi | 158 | let g:jedi#show_call_signatures = 1 " which sadly does not support signatures like jedi |
173 | let g:jedi#show_call_signatures_delay = 0 | 159 | let g:jedi#show_call_signatures_delay = 0 |
174 | let g:jedi#auto_vim_configure = 0 | 160 | let g:jedi#auto_vim_configure = 0 |
175 | let g:pymode_rope = 0 " https://github.com/davidhalter/jedi-vim/issues/163 | 161 | let 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 | ||
180 | Plug 'honza/vim-snippets' " dependency of ultisnips (see below) | 166 | " ULTISNIPS: code snippet ============================================================================================== |
181 | Plug 'SirVer/ultisnips' " replaces loremipsum (and many more) | 167 | Plug 'honza/vim-snippets' " dependency of ultisnips (see below) |
168 | Plug '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 | ||
214 | call plug#end() | " all plugins are getting loaded on this line, don't remove! | 194 | call 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 | "======================================================================================================================= | ||
216 | filetype on | 202 | filetype on |
217 | filetype plugin on | 203 | filetype plugin on |
218 | filetype indent on | 204 | filetype indent on |
205 | |||
219 | syntax on | " enable syntax highlighting | 206 | syntax on | " enable syntax highlighting |
220 | syntax sync minlines=60 | " how many preceding lines will be parsed? (has performance impact) | 207 | syntax 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 =======================================. | ||
226 | inoremap <C-Space> <C-x><C-o> | ||
227 | "inoremap <C-@> <C-Space> | ||
228 | vnoremap < <gv| " allows deindenting a selected block and keeps selection | ||
229 | vnoremap > >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) | ||
233 | inoremap | ||
234 | \ <C-Backspace> | ||
235 | \ <C-W> | ||
236 | |||
237 | noremap <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). | ||
241 | inoremap <C-V> <C-R>+ | ||
242 | inoremap <C-S> <C-O>:w<CR> | ||
243 | |||
244 | |||
245 | 208 | ||
209 | "======================================================================================================================= | ||
210 | " SPELL_CHECKING: | ||
211 | "======================================================================================================================= | ||
212 | set spell | " enable spell checker | ||
213 | set spelllang=en,de | " languages for the spell checker | ||
214 | set spellsuggest=10 | " how many words will z= suggest? | ||
215 | set thesaurus+=/home/max/.vim/thesaurus/php.txt | ||
216 | let g:spellfile_URL='http://ftp.vim.org/vim/runtime/spell' | ||
246 | 217 | ||
247 | " spell checkers? | ||
248 | set spell spelllang=en,de | " enable spell checker | ||
249 | set dictionary=/usr/share/dict/cracklib-small | 218 | set dictionary=/usr/share/dict/cracklib-small |
250 | set complete+=k " make default completer <C-N> respect the dictionary | 219 | set complete+=k " make default completer <C-N> respect the dictionary |
251 | 220 | ||
252 | let g:spellfile_URL = 'http://ftp.vim.org/vim/runtime/spell' | 221 | "======================================================================================================================= |
253 | 222 | " SETTINGS: | |
254 | " settings ============================================. | 223 | "======================================================================================================================= |
255 | " | 224 | set 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 | ||
258 | set shell=/bin/bash | " many scripts rely on bash, but its path varies why it is commented out here | 225 | set 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 | ||
261 | set breakindent | " Every wrapped line will continue visually indented | 226 | set breakindent | " Every wrapped line will continue visually indented |
262 | set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well) | 227 | set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well) |
263 | set cmdheight=2 | " sets the command line's height | 228 | set cmdheight=2 | " sets the command line's height |
@@ -293,53 +258,71 @@ set redrawtime=400 | " The time in milliseconds for redrawing the dis | |||
293 | set scrolljump=5 | " how many lines get scrolled into view when cursor reaches the screens edge | 258 | set scrolljump=5 | " how many lines get scrolled into view when cursor reaches the screens edge |
294 | set splitbelow | " open new windows below the current one (i find that more intuitive) | 259 | set splitbelow | " open new windows below the current one (i find that more intuitive) |
295 | set shiftround | " indent/unindent snaps to multiple of shiftwidth | 260 | set shiftround | " indent/unindent snaps to multiple of shiftwidth |
296 | set 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) |
262 | set noshowcmd | " essential: show keys of combined commands in the lower right corner (BUT SLOW, makes cursor flickering) | ||
263 | set winwidth=30 | " keep NERDTreeWindow at least this size | ||
264 | set winminwidth=30 | " (and all other windows, so TODO: watch out) | ||
297 | set tags+=../tags | 265 | set tags+=../tags |
298 | set 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...) |
300 | set textwidth=120 | " better done with modeline | 267 | set textwidth=120 | " better done with modeline |
301 | set colorcolumn=120 | " better done with modeline | 268 | set colorcolumn=120 | " better done with modeline |
302 | set thesaurus+=/home/max/.vim/thesaurus/php.txt | ||
303 | set ts=4 sts=4 sw=4 expandtab | " better done with a modeline | 269 | set ts=4 sts=4 sw=4 expandtab | " better done with a modeline |
304 | set ttimeoutlen=10 | " set esc key timeout in ms- | 270 | set ttimeoutlen=10 | " set esc key timeout in ms- |
305 | set updatetime=1000 | " updates the screen more often | 271 | set updatetime=1000 | " updates the screen more often |
306 | set writedelay=0 | 272 | set writedelay=0 |
307 | set lcs+=space:· | " local space char | 273 | set lcs+=space:· | " local space char |
274 | "======================================================================================================================= | ||
275 | " COLORSCHEME: | ||
276 | " set term=xtermc | " may be required on solaris | ||
277 | set t_Co=256 | " required on some ssh sessions | ||
278 | let &t_Co=256 | ||
279 | set background=light | " hint how the terminal background looks like | ||
308 | 280 | ||
309 | if has("multi_byte") | 281 | " set termguicolors |
310 | scriptencoding utf-8 | " tell vim that we are using utf-8 here | 282 | let 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) | 283 | if 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 | 285 | else | |
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) | 292 | endif |
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 | ||
324 | end | ||
325 | 293 | ||
326 | if has("gui_running") | 294 | highlight normal ctermbg=NONE | " uses the default terminal background color as background (allows transparency) |
327 | set toolbar+=text | 295 | highlight 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 | 298 | highlight 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 | 301 | if 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) | ||
339 | endif | 305 | endif |
340 | 306 | ||
307 | "======================================================================================================================= | ||
308 | if 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 | ||
323 | end | ||
341 | 324 | ||
342 | if has('cscope') | 325 | if 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 |
358 | endif | 341 | endif |
359 | |||
360 | 342 | ||
361 | if bufname('%') == '' | 343 | " GUI_VERSION: |
362 | set bufhidden=wipe | 344 | if 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 | ||
363 | endif | 359 | endif |
364 | 360 | ||
365 | " noautocmd | 361 | " NEOVIM_incompatible: |
362 | if !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 | ||
367 | endif | ||
366 | 368 | ||
367 | if has("autocmd") | 369 | if 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 | ||
510 | endif | ||
511 | 475 | ||
512 | let &t_Co=256 | 476 | augroup extra_whitespace " { |
513 | set background=dark | 477 | highlight ExtraWhitespace ctermbg=red guibg=red |
514 | " set termguicolors | 478 | autocmd BufEnter * syn match ExtraWhitespace /\s\+$/ |
515 | let base16colorspace=256 | 479 | augroup END "} |
516 | if filereadable(expand("~/.vimrc_background")) | ||
517 | source ~/.vimrc_background | ||
518 | else | ||
519 | colorscheme base16-phd | ||
520 | endif | ||
521 | 480 | ||
481 | augroup CurrentFileName | ||
482 | highlight CurrentFileName ctermbg=yellow guibg=yellow | ||
522 | 483 | ||
523 | highlight ExtraWhitespace ctermbg=red guibg=red | 484 | " highlight the current files name inside the document... |
524 | syn 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 | ||
527 | if !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 | ||
532 | else | ||
533 | " shortcut \t opens a terminal in a horizontal split | ||
534 | nnoremap <leader>t :new +terminal<CR> | ||
535 | endif | 495 | endif |
536 | 496 | ||
537 | nnoremap <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 | 500 | inoremap <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) | ||
504 | inoremap | ||
505 | \ <C-Backspace> | ||
506 | \ <C-W> | ||
507 | |||
508 | " INDENTATION: allows deindenting a selected block and keeps selection | ||
509 | vnoremap < <gv | ||
510 | vnoremap > >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 | 513 | nnoremap <leader>q :bp<bar>sp<bar>bn<bar>bd<CR>. |
548 | 514 | ||
515 | nnoremap <silent> <F5> :make<CR> | ||
516 | nnoremap <silent> <F6> :silent syntax sync fromstart<CR>:nohlsearch<CR>:silent match<CR> | ||
517 | nnoremap <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). | ||
523 | inoremap <C-V> <C-R>+ | ||
524 | inoremap <C-S> <C-O>:w<CR> | ||
525 | |||
526 | " NEOVIM_SPECIFIC: | ||
527 | if has('nvim') " only neovim... | ||
528 | " shortcut \t opens a terminal in a horizontal split | ||
529 | nnoremap <leader>t :new +terminal<CR> | ||
530 | endif | ||
531 | |||
532 | " ====================================================================================================================== | ||
533 | " Deprecated with this configuration, but still useful when deactivating some Plugins | ||
534 | |||
535 | " NETRW: obsolete with NERDTree | ||
536 | let g:netrw_alto = 0 | " open files on the right | ||
537 | let g:netrw_altv = 1 | " open files on the right | ||
538 | let g:netrw_banner = 0 | " display help messages? | ||
539 | let g:netrw_browse_split = 4 | " 4=open in previous window | ||
540 | let g:netrw_fastbrowse = 2 | " manually refresh direcory list (avoids display errors) | ||
541 | let g:netrw_hide = 1 | " show not-hidden files only | ||
542 | let g:netrw_keepdir = 0 | ||
543 | let g:netrw_list_hide = '^\..*' | " Explore mode: hide files starting with dot | ||
544 | let g:netrw_liststyle = 3 | " 3=tree | ||
545 | let g:netrw_preview = 0 | " | ||
546 | let 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 | |||