1 " My personal vim, nvim, gvim configuration
2 " Author: Stefan Huber <shuber@sthu.org>
5 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
15 set fillchars=vert:│,fold:\
16 set listchars=tab:»,trail:·,eol:$
19 filetype plugin indent on
38 set wildmode=longest,list:full
47 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
48 " Some global plugin settings
50 " Disable devicons on linux terminal
52 let g:enable_plugin_devicons=0
53 " Enable loading of devicons on all others
55 let g:enable_plugin_devicons=1
60 let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*']
62 " Some preferences for indent detection
63 let g:detectindent_min_indent = 2
64 let g:detectindent_max_indent = 4
65 let g:detectindent_preferred_indent = 4
67 " Attention: Must be run after plugsetup.vim
69 highlight default link BadWhitespace SpellCap
71 " Setup BadWhitespace syntax match expressions.
72 function SetBadWhitespaceSyntax()
73 " Do not expose bad whitespace in help buffers or for man pages. Or, more
74 " generally, if we open the file readonly.
75 "if &ft != "help" && &ft != "man"
77 " Make trailing whitespace be flagged as bad.
78 syn match BadWhitespace /\s\+$/ containedin=ALL
79 " Make space before tab be flagged as bad and vice versa
80 syn match BadWhitespace / \+\t/ containedin=ALL
81 syn match BadWhitespace /\t \+/ containedin=ALL
85 " Make trailing whitespace be flagged as bad.
86 au BufRead,BufNewFile * call SetBadWhitespaceSyntax()
88 let g:airline_powerline_fonts=1
89 let g:airline#extensions#tabline#enabled=1
90 let g:airline#extensions#branch#enabled=1
92 let g:gruvbox_contrast_light='hard'
93 let g:gruvbox_contrast_dark='hard'
97 let g:gruvbox_termcolors=16
99 " Setting termguicolors has two implications:
100 " - Breaks colors for some versions of mosh, but not if tmux is used on top of
101 " mosh. See https://github.com/mobile-shell/mosh/issues/928
103 let g:gruvbox_italic = 1
107 " let NERDTreeWinPos="right"
108 let NERDTreeHijackNetrw=0
109 let NERDTreeWinSize=22
110 let NERDTreeQuitOnOpen=1
111 "au VimEnter * if !argc() | Startify | NERDTree | wincmd w
113 let g:neomake_c_enabled_makers = ['clangtidy', 'clangcheck']
114 let g:neomake_cpp_enabled_makers = ['clangtidy', 'clangcheck']
118 call neomake#configure#automake('w')
120 call neomake#configure#automake('nw', 1000)
123 let g:clang_compilation_database = '.'
125 " Speedup deoplete startup time, see deoplete FAQ
126 let g:python3_host_prog = '/usr/bin/python3'
127 " deoplete requires huge startuptime. Delay loading upon first InsertEnter.
128 let g:deoplete#enable_at_startup = 0
129 call deoplete#custom#option({
130 \ 'smart_case' : v:true,
131 \ 'auto_refresh_delay' : 100,
133 au InsertEnter * call deoplete#enable()
137 "au FileType markdown,mkd call pencil#init()
138 "au FileType text call pencil#init()
139 "au FileType mail call pencil#init()
140 "au FileType tex call pencil#init()
143 let g:vim_markdown_frontmatter=1
144 let g:vim_markdown_math=1
147 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
148 " Some filetype-specific settings
150 au FileType text,markdown,asciidoc,mail,gitcommit,mediawiki,vimwiki,tex setlocal spell
151 au FileType text,markdown,asciidoc,mail,gitcommit,mediawiki,vimwiki setlocal formatoptions+=n
152 au Filetype mail setlocal formatoptions+=o
153 " Add | for block quotation, such that gq respects it
154 au Filetype mail setlocal comments+=n:\|,
156 au Filetype go setlocal shiftwidth=8 tabstop=8 noexpandtab
157 au Filetype tex setlocal shiftwidth=2 tabstop=2
159 au FileType mediawiki setlocal wrap linebreak textwidth=0
162 au Filetype mail syn match Statement /^\s*-*\s*>8\s*-*\s*$/
163 au Filetype mail syn match Statement /^\s*-*\s*8<\s*-*\s*$/
165 " Line wrap crippled with numbers shown
166 au Filetype man setlocal nonumber
168 " Minimum indenting for source code
169 au FileType java,cpp,c,cs let g:detectindent_min_indent = 4
170 " Consider using localvimrc config file or editorconfig instead
171 "au BufReadPost *.java :DetectIndent
173 au BufEnter *.c* let b:fswitchlocs='reg:/lib/include/,rel:.'
174 au BufEnter *.h* let b:fswitchlocs='reg:/include/lib/,rel:.'
176 au BufEnter *.cpp,*.cc,*.cxx let b:fswitchdst='h,hxx,hpp,hh'
177 au BufEnter *.h,*.hh,*.hxx let b:fswitchdst='cc,c,cxx,cpp'
178 au BufNewFile *.{h,hpp,hxx} call AddIncludeGuards()
180 au FileType cpp,c packadd termdebug
182 augroup autofoldcolumn
184 au CursorHold,BufWinEnter * AutoOrigamiFoldColumn
187 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
188 " Some plugin-specific settings
190 let g:localvimrc_persistent = 1
192 let g:fastfold_minlines = 0
194 au FileType markdown call RagtagInit()
196 let g:detectspelllang_langs = {}
197 let g:detectspelllang_langs.aspell =[ 'en_US', 'de_AT']
198 au FileType mail let g:VimMailSpellLangs=['de', 'en']
200 :let g:org_todo_keywords = [['TODO(t)', 'WAITING(w)', '|', 'DONE(d)'],
201 \ ['|', 'OBSOLETE(o)', 'WONT(n)'],
204 let g:vimwiki_list = [{'path': '~/.vimwiki/',
205 \ 'template_path': '~/.vim/vimwiki/templates',
206 \ 'template_default': 'default',
207 \ 'template_ext': '.html'}]
208 let g:vimwiki_global_ext = 0
211 au FileType java setlocal omnifunc=javacomplete#Complete
212 au FileType java JCEnable
214 let g:VimMailContactsProvider=['khard']
215 let g:VimMailContactsCommands={
217 \{ 'query' : "khard email --parsable --search-in-source-files",
218 \'sync': "/bin/true"}
221 let g:vimtex_fold_enabled = 1
222 let g:vimtex_fold_levelmarker = '➜'
224 " The denite settings are largely stolen from spacevim
225 let s:denite_options = {
229 \ 'start_filter' : 1,
231 \ 'highlight_matched_char' : 'MoreMsg',
232 \ 'highlight_matched_range' : 'MoreMsg',
233 \ 'direction': 'rightbelow',
236 augroup spacevim_layer_denite
238 autocmd FileType denite call s:denite_my_settings()
241 function! s:denite_my_settings() abort
242 nnoremap <silent><buffer><expr> i
243 \ denite#do_map('open_filter_buffer')
244 nnoremap <silent><buffer><expr> '
245 \ denite#do_map('toggle_select').'j'
246 nnoremap <silent><buffer><expr> q
247 \ denite#do_map('quit')
248 nnoremap <silent><buffer><expr> <C-t>
249 \ denite#do_map('do_action', 'tabopen')
250 nnoremap <silent><buffer><expr> <C-v>
251 \ denite#do_map('do_action', 'vsplit')
252 nnoremap <silent><buffer><expr> <C-s>
253 \ denite#do_map('do_action', 'split')
254 nnoremap <silent><buffer><expr> <CR>
255 \ denite#do_map('do_action')
256 nnoremap <silent><buffer><expr> p
257 \ denite#do_map('do_action', 'preview')
258 nnoremap <silent><buffer><Tab> j
259 nnoremap <silent><buffer><S-Tab> k
262 " FIND and GREP COMMANDS
264 " Ripgrep command on grep source
265 call denite#custom#var('grep', 'command', ['rg'])
266 call denite#custom#var('grep', 'default_opts',
267 \ ['--vimgrep', '--no-heading'])
268 call denite#custom#var('grep', 'recursive_opts', [])
269 call denite#custom#var('grep', 'pattern_opt', ['--regexp'])
270 call denite#custom#var('grep', 'separator', ['--'])
271 call denite#custom#var('grep', 'final_opts', [])
274 let s:insert_mode_mappings = [
275 \ ['jk', '<denite:enter_mode:normal>', 'noremap'],
276 \ ['<Tab>', '<denite:move_to_next_line>', 'noremap'],
277 \ ['<C-j>', '<denite:move_to_next_line>', 'noremap'],
278 \ ['<S-tab>', '<denite:move_to_previous_line>', 'noremap'],
279 \ ['<C-k>', '<denite:move_to_previous_line>', 'noremap'],
280 \ ['<C-t>', '<denite:do_action:tabopen>', 'noremap'],
281 \ ['<C-v>', '<denite:do_action:vsplit>', 'noremap'],
282 \ ['<C-s>', '<denite:do_action:split>', 'noremap'],
283 \ ['<Esc>', '<denite:enter_mode:normal>', 'noremap'],
284 \ ['<C-N>', '<denite:assign_next_matched_text>', 'noremap'],
285 \ ['<C-P>', '<denite:assign_previous_matched_text>', 'noremap'],
286 \ ['<Up>', '<denite:assign_previous_text>', 'noremap'],
287 \ ['<Down>', '<denite:assign_next_text>', 'noremap'],
288 \ ['<C-Y>', '<denite:redraw>', 'noremap'],
291 let s:normal_mode_mappings = [
292 \ ["'", '<denite:toggle_select_down>', 'noremap'],
293 \ ['<C-n>', '<denite:jump_to_next_source>', 'noremap'],
294 \ ['<C-p>', '<denite:jump_to_previous_source>', 'noremap'],
295 \ ['<Tab>', '<denite:move_to_next_line>', 'noremap'],
296 \ ['<C-j>', '<denite:move_to_next_line>', 'noremap'],
297 \ ['<S-tab>', '<denite:move_to_previous_line>', 'noremap'],
298 \ ['<C-k>', '<denite:move_to_previous_line>', 'noremap'],
299 \ ['gg', '<denite:move_to_first_line>', 'noremap'],
300 \ ['<C-t>', '<denite:do_action:tabopen>', 'noremap'],
301 \ ['<C-v>', '<denite:do_action:vsplit>', 'noremap'],
302 \ ['<C-s>', '<denite:do_action:split>', 'noremap'],
303 \ ['q', '<denite:quit>', 'noremap'],
304 \ ['r', '<denite:redraw>', 'noremap'],
307 " termdebug split windows
308 let g:termdebug_wide = 1
309 let termdebugger = $HOME . '/.vim/gdb.sh'
311 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
315 if filereadable($HOME . '/.vim/init-local.vim')
316 source ~/.vim/init-local.vim