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
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'
94 let g:gruvbox_italic = 1
98 " let NERDTreeWinPos="right"
99 let NERDTreeHijackNetrw=0
100 let NERDTreeWinSize=22
101 let NERDTreeQuitOnOpen=1
102 "au VimEnter * if !argc() | Startify | NERDTree | wincmd w
104 let g:neomake_c_enabled_makers = ['clangtidy', 'clangcheck']
105 let g:neomake_cpp_enabled_makers = ['clangtidy', 'clangcheck']
109 call neomake#configure#automake('w')
111 call neomake#configure#automake('nw', 1000)
114 let g:clang_compilation_database = '.'
116 " Speedup deoplete startup time, see deoplete FAQ
117 let g:python3_host_prog = '/usr/bin/python3'
118 " deoplete requires huge startuptime. Delay loading upon first InsertEnter.
119 let g:deoplete#enable_at_startup = 0
120 let g:deoplete#enable_smart_case = 1
121 au InsertEnter * call deoplete#enable()
125 "au FileType markdown,mkd call pencil#init()
126 "au FileType text call pencil#init()
127 "au FileType mail call pencil#init()
128 "au FileType tex call pencil#init()
131 let g:vim_markdown_folding_disabled=1
132 let g:vim_markdown_frontmatter=1
133 let g:vim_markdown_math=1
136 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
137 " Some filetype-specific settings
139 au FileType text,markdown,mail,tex,gitcommit,mediawiki,vimwiki setlocal spell
140 au FileType text,markdown,mail,gitcommit,mediawiki,vimwiki setlocal formatoptions+=n
141 au Filetype mail setlocal formatoptions+=o
142 " Add | for block quotation, such that gq respects it
143 au Filetype mail setlocal comments+=n:\|
145 au Filetype go setlocal shiftwidth=8 tabstop=8 noexpandtab
146 au Filetype tex setlocal shiftwidth=2 tabstop=2
148 au FileType mediawiki setlocal wrap linebreak textwidth=0
151 au Filetype mail syn match Statement /^\s*-*\s*>8\s*-*\s*$/
152 au Filetype mail syn match Statement /^\s*-*\s*8<\s*-*\s*$/
154 " Line wrap crippled with numbers shown
155 au Filetype man setlocal nonumber
157 " Minimum indenting for source code
158 au FileType java,cpp,c,cs let g:detectindent_min_indent = 4
159 " Consider using localvimrc config file or editorconfig instead
160 "au BufReadPost *.java :DetectIndent
162 au BufEnter *.c* let b:fswitchlocs='reg:/lib/include/,rel:.'
163 au BufEnter *.h* let b:fswitchlocs='reg:/include/lib/,rel:.'
165 au BufEnter *.cpp,*.cc,*.cxx let b:fswitchdst='h,hxx,hpp,hh'
166 au BufEnter *.h,*.hh,*.hxx let b:fswitchdst='cc,c,cxx,cpp'
167 au BufNewFile *.{h,hpp,hxx} call AddIncludeGuards()
169 augroup autofoldcolumn
171 au CursorHold,BufWinEnter * AutoOrigamiFoldColumn
174 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
175 " Some plugin-specific settings
177 let g:localvimrc_persistent = 1
179 au FileType markdown call RagtagInit()
181 let g:detectspelllang_langs = {}
182 let g:detectspelllang_langs.aspell =[ 'en_US', 'de_AT']
183 au FileType mail let g:VimMailSpellLangs=['de', 'en']
185 :let g:org_todo_keywords = [['TODO(t)', 'WAITING(w)', '|', 'DONE(d)'],
186 \ ['|', 'OBSOLETE(o)', 'WONT(n)'],
189 let g:vimwiki_list = [{'path': '~/.vimwiki/',
190 \ 'template_path': '~/.vim/vimwiki/templates',
191 \ 'template_default': 'default',
192 \ 'template_ext': '.html'}]
195 au FileType java setlocal omnifunc=javacomplete#Complete
196 au FileType java JCEnable
197 " See https://github.com/artur-shaik/vim-Javacomplete2
199 au FileType java nmap <F4> <Plug>(JavaComplete-Imports-AddSmart)
200 au FileType java imap <F4> <Plug>(JavaComplete-Imports-AddSmart)
201 " <C-j>ii <leader>jii
202 au FileType java nmap <F5> <Plug>(JavaComplete-Imports-Add)
203 au FileType java imap <F5> <Plug>(JavaComplete-Imports-Add)
205 au FileType java nmap <F6> <Plug>(JavaComplete-Imports-AddMissing)
206 au FileType java imap <F6> <Plug>(JavaComplete-Imports-AddMissing)
208 au FileType java nmap <F7> <Plug>(JavaComplete-Imports-RemoveUnused)
209 au FileType java imap <F7> <Plug>(JavaComplete-Imports-RemoveUnused)
211 let g:VimMailContactsProvider=['khard']
212 let g:VimMailContactsCommands={
214 \{ 'query' : "khard email --parsable --search-in-source-files",
215 \'sync': "/bin/true"}
218 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
222 if filereadable($HOME . '/.vim/init-local.vim')
223 source ~/.vim/init-local.vim