1 " My personal vim, nvim, gvim configuration
2 " Author: Stefan Huber <shuber@sthu.org>
5 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
9 " Breaks colors for some versions of mosh, but not if tmux is used on top of
10 " mosh. See https://github.com/mobile-shell/mosh/issues/928
18 set listchars=tab:»,trail:·,eol:$
21 filetype plugin indent on
40 set wildmode=longest,list:full
49 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
50 " Some global plugin settings
52 " Disable devicons on linux terminal
54 let g:enable_plugin_devicons=0
55 " Enable loading of devicons on all others
57 let g:enable_plugin_devicons=1
62 let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*']
64 " Some preferences for indent detection
65 let g:detectindent_min_indent = 2
66 let g:detectindent_max_indent = 4
67 let g:detectindent_preferred_indent = 4
69 " Attention: Must be run after plugsetup.vim
71 highlight default link BadWhitespace SpellCap
73 " Setup BadWhitespace syntax match expressions.
74 function SetBadWhitespaceSyntax()
75 " Do not expose bad whitespace in help buffers or for man pages. Or, more
76 " generally, if we open the file readonly.
77 "if &ft != "help" && &ft != "man"
79 " Make trailing whitespace be flagged as bad.
80 syn match BadWhitespace /\s\+$/ containedin=ALL
81 " Make space before tab be flagged as bad and vice versa
82 syn match BadWhitespace / \+\t/ containedin=ALL
83 syn match BadWhitespace /\t \+/ containedin=ALL
87 " Make trailing whitespace be flagged as bad.
88 au BufRead,BufNewFile * call SetBadWhitespaceSyntax()
90 let g:airline_powerline_fonts=1
91 let g:airline#extensions#tabline#enabled=1
92 let g:airline#extensions#branch#enabled=1
94 let g:gruvbox_contrast_light='hard'
95 let g:gruvbox_contrast_dark='hard'
96 let g:gruvbox_italic = 1
100 " let NERDTreeWinPos="right"
101 let NERDTreeHijackNetrw=0
102 let NERDTreeWinSize=22
103 let NERDTreeQuitOnOpen=1
104 "au VimEnter * if !argc() | Startify | NERDTree | wincmd w
106 let g:neomake_c_enabled_makers = ['clangtidy', 'clangcheck']
107 let g:neomake_cpp_enabled_makers = ['clangtidy', 'clangcheck']
111 call neomake#configure#automake('w')
113 call neomake#configure#automake('nw', 1000)
116 let g:clang_compilation_database = '.'
118 " Speedup deoplete startup time, see deoplete FAQ
119 let g:python3_host_prog = '/usr/bin/python3'
120 " deoplete requires huge startuptime. Delay loading upon first InsertEnter.
121 let g:deoplete#enable_at_startup = 0
122 let g:deoplete#enable_smart_case = 1
123 au InsertEnter * call deoplete#enable()
127 "au FileType markdown,mkd call pencil#init()
128 "au FileType text call pencil#init()
129 "au FileType mail call pencil#init()
130 "au FileType tex call pencil#init()
133 let g:vim_markdown_frontmatter=1
134 let g:vim_markdown_math=1
137 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
138 " Some filetype-specific settings
140 au FileType text,markdown,asciidoc,mail,gitcommit,mediawiki,vimwiki,tex setlocal spell
141 au FileType text,markdown,asciidoc,mail,gitcommit,mediawiki,vimwiki setlocal formatoptions+=n
142 au Filetype mail setlocal formatoptions+=o
143 " Add | for block quotation, such that gq respects it
144 au Filetype mail setlocal comments+=n:\|,
146 au Filetype go setlocal shiftwidth=8 tabstop=8 noexpandtab
147 au Filetype tex setlocal shiftwidth=2 tabstop=2
149 au FileType mediawiki setlocal wrap linebreak textwidth=0
152 au Filetype mail syn match Statement /^\s*-*\s*>8\s*-*\s*$/
153 au Filetype mail syn match Statement /^\s*-*\s*8<\s*-*\s*$/
155 " Line wrap crippled with numbers shown
156 au Filetype man setlocal nonumber
158 " Minimum indenting for source code
159 au FileType java,cpp,c,cs let g:detectindent_min_indent = 4
160 " Consider using localvimrc config file or editorconfig instead
161 "au BufReadPost *.java :DetectIndent
163 au BufEnter *.c* let b:fswitchlocs='reg:/lib/include/,rel:.'
164 au BufEnter *.h* let b:fswitchlocs='reg:/include/lib/,rel:.'
166 au BufEnter *.cpp,*.cc,*.cxx let b:fswitchdst='h,hxx,hpp,hh'
167 au BufEnter *.h,*.hh,*.hxx let b:fswitchdst='cc,c,cxx,cpp'
168 au BufNewFile *.{h,hpp,hxx} call AddIncludeGuards()
170 augroup autofoldcolumn
172 au CursorHold,BufWinEnter * AutoOrigamiFoldColumn
175 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
176 " Some plugin-specific settings
178 let g:localvimrc_persistent = 1
180 au FileType markdown call RagtagInit()
182 let g:detectspelllang_langs = {}
183 let g:detectspelllang_langs.aspell =[ 'en_US', 'de_AT']
184 au FileType mail let g:VimMailSpellLangs=['de', 'en']
186 :let g:org_todo_keywords = [['TODO(t)', 'WAITING(w)', '|', 'DONE(d)'],
187 \ ['|', 'OBSOLETE(o)', 'WONT(n)'],
190 let g:vimwiki_list = [{'path': '~/.vimwiki/',
191 \ 'template_path': '~/.vim/vimwiki/templates',
192 \ 'template_default': 'default',
193 \ 'template_ext': '.html'}]
194 let g:vimwiki_global_ext = 0
197 au FileType java setlocal omnifunc=javacomplete#Complete
198 au FileType java JCEnable
200 let g:VimMailContactsProvider=['khard']
201 let g:VimMailContactsCommands={
203 \{ 'query' : "khard email --parsable --search-in-source-files",
204 \'sync': "/bin/true"}
207 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
211 if filereadable($HOME . '/.vim/init-local.vim')
212 source ~/.vim/init-local.vim