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
37 set wildmode=longest,list:full
41 " Some terminals cause weired symbols due to broken cursor-shape termcodes.
44 " Workaround some broken plugins which set guicursor indiscriminately.
45 "au OptionSet guicursor noautocmd set guicursor=
53 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
54 " Some global plugin settings
56 " Disable devicons on linux terminal
58 let g:enable_plugin_devicons=0
59 " Enable loading of devicons on all others
61 let g:enable_plugin_devicons=1
66 let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*']
68 " Some preferences for indent detection
69 let g:detectindent_min_indent = 2
70 let g:detectindent_max_indent = 4
71 let g:detectindent_preferred_indent = 4
73 " Attention: Must be run after plugsetup.vim
75 highlight default link BadWhitespace SpellCap
77 " Setup BadWhitespace syntax match expressions.
78 function SetBadWhitespaceSyntax()
79 " Do not expose bad whitespace in help buffers or for man pages. Or, more
80 " generally, if we open the file readonly.
81 "if &ft != "help" && &ft != "man"
83 " Make trailing whitespace be flagged as bad.
84 syn match BadWhitespace /\s\+$/ containedin=ALL
85 " Make space before tab be flagged as bad and vice versa
86 syn match BadWhitespace / \+\t/ containedin=ALL
87 syn match BadWhitespace /\t \+/ containedin=ALL
91 " Make trailing whitespace be flagged as bad.
92 au BufRead,BufNewFile * call SetBadWhitespaceSyntax()
94 let g:airline_powerline_fonts=1
95 let g:airline#extensions#tabline#enabled=1
96 let g:airline#extensions#branch#enabled=1
98 let g:gruvbox_contrast_light='hard'
99 let g:gruvbox_contrast_dark='hard'
100 let g:gruvbox_italic = 1
104 " let NERDTreeWinPos="right"
105 let NERDTreeHijackNetrw=0
106 let NERDTreeWinSize=22
107 let NERDTreeQuitOnOpen=1
108 "au VimEnter * if !argc() | Startify | NERDTree | wincmd w
110 let g:neomake_c_enabled_makers = ['clangtidy', 'clangcheck']
111 let g:neomake_cpp_enabled_makers = ['clangtidy', 'clangcheck']
115 call neomake#configure#automake('w')
117 call neomake#configure#automake('nw', 1000)
120 let g:clang_compilation_database = '.'
122 " Speedup deoplete startup time, see deoplete FAQ
123 let g:python3_host_prog = '/usr/bin/python3'
124 " deoplete requires huge startuptime. Delay loading upon first InsertEnter.
125 let g:deoplete#enable_at_startup = 0
126 let g:deoplete#enable_smart_case = 1
127 au InsertEnter * call deoplete#enable()
131 "au FileType markdown,mkd call pencil#init()
132 "au FileType text call pencil#init()
133 "au FileType mail call pencil#init()
134 "au FileType tex call pencil#init()
137 let g:vim_markdown_folding_disabled=1
138 let g:vim_markdown_frontmatter=1
139 let g:vim_markdown_math=1
142 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
143 " Some filetype-specific settings
145 au FileType text,markdown,mail,tex,gitcommit,mediawiki,vimwiki setlocal spell
146 au FileType text,markdown,mail,gitcommit,mediawiki,vimwiki setlocal fo+=n
148 au Filetype go setlocal shiftwidth=8 tabstop=8 noexpandtab
149 au Filetype tex setlocal shiftwidth=2 tabstop=2
151 au FileType mediawiki setlocal wrap linebreak tw=0
154 au Filetype mail syn match Statement /^\s*-*\s*>8\s*-*\s*$/
155 au Filetype mail syn match Statement /^\s*-*\s*8<\s*-*\s*$/
157 " Line wrap crippled with numbers shown
158 au Filetype man setlocal nonumber
160 " Minimum indenting for source code
161 au FileType java,cpp,c,cs let g:detectindent_min_indent = 4
162 " Consider using localvimrc config file or editorconfig instead
163 "au BufReadPost *.java :DetectIndent
165 au BufEnter *.c* let b:fswitchlocs='reg:/lib/include/,rel:.'
166 au BufEnter *.h* let b:fswitchlocs='reg:/include/lib/,rel:.'
168 au BufEnter *.cpp,*.cc,*.cxx let b:fswitchdst='h,hxx,hpp,hh'
169 au BufEnter *.h,*.hh,*.hxx let b:fswitchdst='cc,c,cxx,cpp'
170 au BufNewFile *.{h,hpp,hxx} call AddIncludeGuards()
172 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
173 " Some plugin-specific settings
175 let g:localvimrc_persistent = 1
177 au FileType markdown call RagtagInit()
179 let g:detectspelllang_langs = {}
180 let g:detectspelllang_langs.aspell =[ 'en_US', 'de_AT']
182 :let g:org_todo_keywords = [['TODO(t)', 'WAITING(w)', '|', 'DONE(d)'],
183 \ ['|', 'OBSOLETE(o)', 'WONT(n)'],
186 let g:vimwiki_list = [{'path': '~/.vimwiki/',
187 \ 'template_path': '~/.vim/vimwiki/templates',
188 \ 'template_default': 'default',
189 \ 'template_ext': '.html'}]
192 au FileType java setlocal omnifunc=javacomplete#Complete
193 au FileType java JCEnable
194 " See https://github.com/artur-shaik/vim-Javacomplete2
196 au FileType java nmap <F4> <Plug>(JavaComplete-Imports-AddSmart)
197 au FileType java imap <F4> <Plug>(JavaComplete-Imports-AddSmart)
198 " <C-j>ii <leader>jii
199 au FileType java nmap <F5> <Plug>(JavaComplete-Imports-Add)
200 au FileType java imap <F5> <Plug>(JavaComplete-Imports-Add)
202 au FileType java nmap <F6> <Plug>(JavaComplete-Imports-AddMissing)
203 au FileType java imap <F6> <Plug>(JavaComplete-Imports-AddMissing)
205 au FileType java nmap <F7> <Plug>(JavaComplete-Imports-RemoveUnused)
206 au FileType java imap <F7> <Plug>(JavaComplete-Imports-RemoveUnused)
209 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
213 if filereadable($HOME . '/.vim/init-local.vim')
214 source ~/.vim/init-local.vim