init: Do not let vimwiki catch all markdown files
[vimconf.git] / init.vim
1 " My personal vim, nvim, gvim configuration
2 " Author: Stefan Huber <shuber@sthu.org>
3
4
5 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
6 " Some global settings
7
8 set nocompatible
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
11 set termguicolors
12 set number
13 set cursorline
14 set scrolloff=5
15
16 set encoding=utf-8
17
18 set listchars=tab:»­,trail:·,eol:$
19 set virtualedit=block
20
21 filetype plugin indent on
22
23 set tabstop=4
24 set shiftwidth=4
25 set expandtab
26 set smarttab
27
28 set autoindent
29 set smartindent
30
31 set incsearch
32 set hlsearch
33
34 set foldcolumn=4
35 set colorcolumn=+1
36 set mouse=a
37 set wildmenu
38 set wildmode=longest,list:full
39
40 set tabpagemax=100
41
42 syntax on
43
44 " Load some macros
45 runtime macros.vim
46
47 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
48 " Some global plugin settings
49
50 " Disable devicons on linux terminal
51 if $TERM == 'linux'
52 let g:enable_plugin_devicons=0
53 " Enable loading of devicons on all others
54 else
55 let g:enable_plugin_devicons=1
56 endif
57
58 runtime plugsetup.vim
59
60 let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*']
61
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
66
67 " Attention: Must be run after plugsetup.vim
68 " Trailing whitespace
69 highlight default link BadWhitespace SpellCap
70
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"
76 if !&readonly
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
82 endif
83 endfunction
84
85 " Make trailing whitespace be flagged as bad.
86 au BufRead,BufNewFile * call SetBadWhitespaceSyntax()
87
88 let g:airline_powerline_fonts=1
89 let g:airline#extensions#tabline#enabled=1
90 let g:airline#extensions#branch#enabled=1
91
92 let g:gruvbox_contrast_light='hard'
93 let g:gruvbox_contrast_dark='hard'
94 let g:gruvbox_italic = 1
95 set bg=dark
96 colorscheme gruvbox
97
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
103
104 let g:neomake_c_enabled_makers = ['clangtidy', 'clangcheck']
105 let g:neomake_cpp_enabled_makers = ['clangtidy', 'clangcheck']
106
107 " Taken from neomake
108 if OnBattery()
109 call neomake#configure#automake('w')
110 else
111 call neomake#configure#automake('nw', 1000)
112 endif
113
114 let g:clang_compilation_database = '.'
115
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()
122
123 "augroup pencil
124 "au!
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()
129 "augroup END
130
131 let g:vim_markdown_folding_disabled=1
132 let g:vim_markdown_frontmatter=1
133 let g:vim_markdown_math=1
134
135
136 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
137 " Some filetype-specific settings
138
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:\|
144
145 au Filetype go setlocal shiftwidth=8 tabstop=8 noexpandtab
146 au Filetype tex setlocal shiftwidth=2 tabstop=2
147
148 au FileType mediawiki setlocal wrap linebreak textwidth=0
149
150 "git scissor line
151 au Filetype mail syn match Statement /^\s*-*\s*>8\s*-*\s*$/
152 au Filetype mail syn match Statement /^\s*-*\s*8<\s*-*\s*$/
153
154 " Line wrap crippled with numbers shown
155 au Filetype man setlocal nonumber
156
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
161
162 au BufEnter *.c* let b:fswitchlocs='reg:/lib/include/,rel:.'
163 au BufEnter *.h* let b:fswitchlocs='reg:/include/lib/,rel:.'
164
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()
168
169 augroup autofoldcolumn
170 au!
171 au CursorHold,BufWinEnter * AutoOrigamiFoldColumn
172 augroup END
173
174 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
175 " Some plugin-specific settings
176
177 let g:localvimrc_persistent = 1
178
179 au FileType markdown call RagtagInit()
180
181 let g:detectspelllang_langs = {}
182 let g:detectspelllang_langs.aspell =[ 'en_US', 'de_AT']
183 au FileType mail let g:VimMailSpellLangs=['de', 'en']
184
185 :let g:org_todo_keywords = [['TODO(t)', 'WAITING(w)', '|', 'DONE(d)'],
186 \ ['|', 'OBSOLETE(o)', 'WONT(n)'],
187 \ ['CANCELED(c)']]
188
189 let g:vimwiki_list = [{'path': '~/.vimwiki/',
190 \ 'template_path': '~/.vim/vimwiki/templates',
191 \ 'template_default': 'default',
192 \ 'template_ext': '.html'}]
193 let g:vimwiki_global_ext = 0
194
195 " Java completion
196 au FileType java setlocal omnifunc=javacomplete#Complete
197 au FileType java JCEnable
198 " See https://github.com/artur-shaik/vim-Javacomplete2
199 " <C-j>ji <leader>ji
200 au FileType java nmap <F4> <Plug>(JavaComplete-Imports-AddSmart)
201 au FileType java imap <F4> <Plug>(JavaComplete-Imports-AddSmart)
202 " <C-j>ii <leader>jii
203 au FileType java nmap <F5> <Plug>(JavaComplete-Imports-Add)
204 au FileType java imap <F5> <Plug>(JavaComplete-Imports-Add)
205 " <C-j>I <leader>jI
206 au FileType java nmap <F6> <Plug>(JavaComplete-Imports-AddMissing)
207 au FileType java imap <F6> <Plug>(JavaComplete-Imports-AddMissing)
208 " <C-j>R <leader>jR
209 au FileType java nmap <F7> <Plug>(JavaComplete-Imports-RemoveUnused)
210 au FileType java imap <F7> <Plug>(JavaComplete-Imports-RemoveUnused)
211
212 let g:VimMailContactsProvider=['khard']
213 let g:VimMailContactsCommands={
214 \'khard':
215 \{ 'query' : "khard email --parsable --search-in-source-files",
216 \'sync': "/bin/true"}
217 \}
218
219 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
220
221 runtime keymaps.vim
222
223 if filereadable($HOME . '/.vim/init-local.vim')
224 source ~/.vim/init-local.vim
225 endif