1 " My personal vim, nvim, gvim configuration
2 " Author: Stefan Huber <shuber@sthu.org>
5 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
16 set listchars=tab:»,trail:·,eol:$
19 filetype plugin indent on
34 set wildmode=longest,list:full
38 " Some terminals cause weired symbols due to broken cursor-shape termcodes.
41 " Workaround some broken plugins which set guicursor indiscriminately.
42 "au OptionSet guicursor noautocmd set guicursor=
50 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
51 " Some global plugin settings
53 " Disable devicons on linux terminal
55 let g:enable_plugin_devicons=0
56 " Enable loading of devicons on all others
58 let g:enable_plugin_devicons=1
63 " Some preferences for indent detection
64 let g:detectindent_min_indent = 2
65 let g:detectindent_max_indent = 4
66 let g:detectindent_preferred_indent = 4
68 " Attention: Must be run after plugsetup.vim
70 highlight default link BadWhitespace SpellCap
72 " Setup BadWhitespace syntax match expressions.
73 function SetBadWhitespaceSyntax()
74 " Do not expose bad whitespace in help buffers or for man pages. Or, more
75 " generally, if we open the file readonly.
76 "if &ft != "help" && &ft != "man"
78 " Make trailing whitespace be flagged as bad.
79 syn match BadWhitespace /\s\+$/ containedin=ALL
80 " Make space before tab be flagged as bad and vice versa
81 syn match BadWhitespace / \+\t/ containedin=ALL
82 syn match BadWhitespace /\t \+/ containedin=ALL
86 " Make trailing whitespace be flagged as bad.
87 au BufRead,BufNewFile * call SetBadWhitespaceSyntax()
89 let g:airline_powerline_fonts=1
90 let g:airline#extensions#tabline#enabled=1
91 let g:airline#extensions#branch#enabled=1
93 let g:gruvbox_contrast_light='hard'
94 let g:gruvbox_contrast_dark='hard'
95 let g:gruvbox_italic = 1
99 " let NERDTreeWinPos="right"
100 let NERDTreeHijackNetrw=0
101 let NERDTreeWinSize=22
102 let NERDTreeQuitOnOpen=1
103 "au VimEnter * if !argc() | Startify | NERDTree | wincmd w
105 let g:neomake_c_enabled_makers = ['clangtidy', 'clangcheck']
106 let g:neomake_cpp_enabled_makers = ['clangtidy', 'clangcheck']
110 call neomake#configure#automake('w')
112 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_folding_disabled=1
134 let g:vim_markdown_frontmatter=1
135 let g:vim_markdown_math=1
138 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
139 " Some filetype-specific settings
141 au FileType text,markdown,mail,tex,gitcommit,mediawiki,vimwiki setlocal spell
142 au FileType text,markdown,mail,gitcommit,mediawiki,vimwiki setlocal fo+=n
144 au Filetype go setlocal shiftwidth=8 tabstop=8 noexpandtab
145 au Filetype tex setlocal shiftwidth=2 tabstop=2
147 au FileType mediawiki setlocal wrap linebreak tw=0
150 au Filetype mail syn match Statement /^\s*-*\s*>8\s*-*\s*$/
151 au Filetype mail syn match Statement /^\s*-*\s*8<\s*-*\s*$/
153 " Line wrap crippled with numbers shown
154 au Filetype man setlocal nonumber
157 au FileType java setlocal omnifunc=javacomplete#Complete
158 au FileType java JCEnable
159 " See https://github.com/artur-shaik/vim-Javacomplete2
161 nmap <F4> <Plug>(JavaComplete-Imports-AddSmart)
162 imap <F4> <Plug>(JavaComplete-Imports-AddSmart)
163 " <C-j>ii <leader>jii
164 nmap <F5> <Plug>(JavaComplete-Imports-Add)
165 imap <F5> <Plug>(JavaComplete-Imports-Add)
167 nmap <F6> <Plug>(JavaComplete-Imports-AddMissing)
168 imap <F6> <Plug>(JavaComplete-Imports-AddMissing)
170 nmap <F7> <Plug>(JavaComplete-Imports-RemoveUnused)
171 imap <F7> <Plug>(JavaComplete-Imports-RemoveUnused)
173 " Minimum indenting for source code
174 au FileType java,cpp,c,cs let g:detectindent_min_indent = 4
176 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
177 " Some plugin-specific settings
179 au FileType markdown call RagtagInit()
181 let g:detectspelllang_langs = {}
182 let g:detectspelllang_langs.aspell =[ 'en_US', 'de_AT']
183 au BufReadPost *.java :DetectIndent
185 au BufEnter *.c* let b:fswitchlocs='reg:/lib/include/,rel:.'
186 au BufEnter *.h* let b:fswitchlocs='reg:/include/lib/,rel:.'
188 au BufEnter *.cpp,*.cc,*.cxx let b:fswitchdst='h,hxx,hpp,hh'
189 au BufEnter *.h,*.hh,*.hxx let b:fswitchdst='cc,c,cxx,cpp'
191 :let g:org_todo_keywords = [['TODO(t)', 'WAITING(w)', '|', 'DONE(d)'],
192 \ ['|', 'OBSOLETE(o)', 'WONT(n)'],
195 let g:vimwiki_list = [{'path': '~/.vimwiki/',
196 \ 'template_path': '~/.vim/vimwiki/templates',
197 \ 'template_default': 'default',
198 \ 'template_ext': '.html'}]
201 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
205 if filereadable($HOME . '/.vim/init-local.vim')
206 source ~/.vim/init-local.vim