ff6dcd8b928ac588727f6c16c9068dd2be793d17
[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 set termguicolors
10 set number
11 set cursorline
12 set scrolloff=5
13
14 set encoding=utf-8
15
16 set listchars=tab:»­,trail:·,eol:$
17 set virtualedit=block
18
19 filetype plugin indent on
20
21 set tabstop=4
22 set shiftwidth=4
23 set expandtab
24 set smarttab
25
26 set autoindent
27 set smartindent
28
29 set incsearch
30 set hlsearch
31
32 set colorcolumn=+1
33 set mouse=a
34 set wildmode=longest,list:full
35
36 if has('nvim')
37 set guicursor=
38 end
39
40 syntax on
41
42
43 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
44 " Some global plugin settings
45
46 runtime plugsetup.vim
47
48 " Attention: Must be run after plugsetup.vim
49 " Trailing whitespace
50 highlight default link BadWhitespace SpellCap
51
52 " Setup BadWhitespace syntax match expressions.
53 function SetBadWhitespaceSyntax()
54 " Do not expose bad whitespace in help buffers or for man pages. Or, more
55 " generally, if we open the file readonly.
56 "if &ft != "help" && &ft != "man"
57 if !&readonly
58 " Make trailing whitespace be flagged as bad.
59 syn match BadWhitespace /\s\+$/ containedin=ALL
60 " Make space before tab be flagged as bad and vice versa
61 syn match BadWhitespace / \+\t/ containedin=ALL
62 syn match BadWhitespace /\t \+/ containedin=ALL
63 endif
64 endfunction
65
66 " Make trailing whitespace be flagged as bad.
67 au BufRead,BufNewFile * call SetBadWhitespaceSyntax()
68
69 let g:airline_powerline_fonts=1
70 let g:airline#extensions#tabline#enabled=1
71 let g:airline#extensions#branch#enabled=1
72
73 let g:gruvbox_contrast_light='hard'
74 let g:gruvbox_contrast_dark='hard'
75 let g:gruvbox_italic = 1
76 set bg=dark
77 colorscheme gruvbox
78
79 " let NERDTreeWinPos="right"
80 let NERDTreeHijackNetrw=0
81 let NERDTreeWinSize=22
82 let NERDTreeQuitOnOpen=1
83 "au VimEnter * if !argc() | Startify | NERDTree | wincmd w
84
85 let g:neomake_c_enabled_makers = ['clangtidy', 'clangcheck']
86 let g:neomake_cpp_enabled_makers = ['clangtidy', 'clangcheck']
87
88 call neomake#configure#automake('w')
89 "let g:neomake_logfile = '/tmp/neomake.log'
90
91 let g:clang_compilation_database = '.'
92
93 " Speedup deoplete startup time, see deoplete FAQ
94 let g:python3_host_prog = '/usr/bin/python3'
95 " deoplete requires huge startuptime. Delay loading upon first InsertEnter.
96 let g:deoplete#enable_at_startup = 0
97 autocmd InsertEnter * call deoplete#enable()
98
99 "augroup pencil
100 "au!
101 "au FileType markdown,mkd call pencil#init()
102 "au FileType text call pencil#init()
103 "au FileType mail call pencil#init()
104 "au FileType tex call pencil#init()
105 "augroup END
106
107 let g:vim_markdown_folding_disabled=1
108 let g:vim_markdown_frontmatter=1
109 let g:vim_markdown_math=1
110
111
112 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
113 " Some filetype settings
114
115 " mutt and neomutt
116 au BufRead,BufNewFile ~/.mutt/tmp/*mutt-* set filetype=mail
117 au BufRead,BufNewFile *.muttrc set filetype=muttrc
118
119 au BufRead,BufNewFile *.cls set filetype=tex
120
121
122 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
123 " Some filetype-specific settings
124
125 au FileType text,markdown,mail,tex,gitcommit,mediawiki,vimwiki setlocal spell
126 au FileType text,markdown,mail,gitcommit,mediawiki,vimwiki set fo+=n
127
128 au Filetype go set shiftwidth=8 tabstop=8 noexpandtab
129 au Filetype tex set shiftwidth=2 tabstop=2
130
131 au FileType mediawiki setlocal wrap linebreak tw=0
132
133 "git scissor line
134 au Filetype mail syn match Statement /^\s*-*\s*>8\s*-*\s*$/
135 au Filetype mail syn match Statement /^\s*-*\s*8<\s*-*\s*$/
136
137 " Line wrap crippled with numbers shown
138 au Filetype man set nonumber
139
140
141 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
142 " Some plugin-specific settings
143
144 au FileType markdown call RagtagInit()
145
146 let g:detectspelllang_langs = {}
147 let g:detectspelllang_langs.aspell =[ 'en_US', 'de_AT']
148 au BufReadPost * :DetectIndent
149
150 au BufEnter *.c* let b:fswitchlocs='reg:/lib/include/,rel:.'
151 au BufEnter *.h* let b:fswitchlocs='reg:/include/lib/,rel:.'
152
153 au BufEnter *.cpp,*.cc,*.cxx let b:fswitchdst='h,hxx,hpp,hh'
154 au BufEnter *.h,*.hh,*.hxx let b:fswitchdst='cc,c,cxx,cpp'
155
156 :let g:org_todo_keywords = [['TODO(t)', 'WAITING(w)', '|', 'DONE(d)'],
157 \ ['|', 'OBSOLETE(o)', 'WONT(n)'],
158 \ ['CANCELED(c)']]
159
160 let g:vimwiki_list = [{'path': '~/.vimwiki/',
161 \ 'template_path': '~/.vim/vimwiki/templates',
162 \ 'template_default': 'default',
163 \ 'template_ext': '.html'}]
164
165
166 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
167
168 runtime macros.vim
169 runtime keymaps.vim
170
171 if filereadable($HOME . '/.vim/init-local.vim')
172 source ~/.vim/init-local.vim
173 endif