e552eff7ff6769794875699c15e8e438a86ad925
[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 " Make trailing whitespace be flagged as bad.
52 au BufRead,BufNewFile * syn match BadWhitespace /\s\+$/ containedin=ALL
53 " Make space before tab be flagged as bad and vice versa
54 au BufRead,BufNewFile * syn match BadWhitespace / \+\t/ containedin=ALL
55 au BufRead,BufNewFile * syn match BadWhitespace /\t \+/ containedin=ALL
56
57 let g:airline_powerline_fonts=1
58 let g:airline#extensions#tabline#enabled=1
59 let g:airline#extensions#branch#enabled=1
60
61 let g:gruvbox_contrast_light='hard'
62 let g:gruvbox_contrast_dark='hard'
63 let g:gruvbox_italic = 1
64 set bg=dark
65 colorscheme gruvbox
66
67 " let NERDTreeWinPos="right"
68 let NERDTreeHijackNetrw=0
69 let NERDTreeWinSize=22
70 let NERDTreeQuitOnOpen=1
71 "au VimEnter * if !argc() | Startify | NERDTree | wincmd w
72
73 let g:neomake_c_enabled_makers = ['clangtidy', 'clangcheck']
74 let g:neomake_cpp_enabled_makers = ['clangtidy', 'clangcheck']
75
76 call neomake#configure#automake('w')
77 "let g:neomake_logfile = '/tmp/neomake.log'
78
79 let g:clang_compilation_database = '.'
80
81 " Speedup deoplete startup time, see deoplete FAQ
82 let g:python3_host_prog = '/usr/bin/python3'
83 " deoplete requires huge startuptime. Delay loading upon first InsertEnter.
84 let g:deoplete#enable_at_startup = 0
85 autocmd InsertEnter * call deoplete#enable()
86
87 "augroup pencil
88 "au!
89 "au FileType markdown,mkd call pencil#init()
90 "au FileType text call pencil#init()
91 "au FileType mail call pencil#init()
92 "au FileType tex call pencil#init()
93 "augroup END
94
95 let g:vim_markdown_folding_disabled=1
96 let g:vim_markdown_frontmatter=1
97 let g:vim_markdown_math=1
98
99
100 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
101 " Some filetype settings
102
103 " mutt and neomutt
104 au BufRead,BufNewFile ~/.mutt/tmp/*mutt-* set filetype=mail
105 au BufRead,BufNewFile *.muttrc set filetype=muttrc
106
107 au BufRead,BufNewFile *.cls set filetype=tex
108
109
110 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
111 " Some filetype-specific settings
112
113 au FileType text,markdown,mail,tex,gitcommit,mediawiki,vimwiki setlocal spell
114 au FileType text,markdown,mail,gitcommit,mediawiki,vimwiki set fo+=n
115
116 au Filetype go set shiftwidth=8 tabstop=8 noexpandtab
117 au Filetype tex set shiftwidth=2 tabstop=2
118
119 au FileType mediawiki setlocal wrap linebreak tw=0
120
121 "git scissor line
122 au Filetype mail syn match Statement /^\s*-*\s*>8\s*-*\s*$/
123 au Filetype mail syn match Statement /^\s*-*\s*8<\s*-*\s*$/
124
125 " Line wrap crippled with numbers shown
126 au Filetype man set nonumber
127
128
129 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
130 " Some plugin-specific settings
131
132 au FileType markdown call RagtagInit()
133
134 let g:guesslang_langs=[ 'en_US', 'de_AT']
135 au BufReadPost * :DetectIndent
136
137 au BufEnter *.c* let b:fswitchlocs='reg:/lib/include/,rel:.'
138 au BufEnter *.h* let b:fswitchlocs='reg:/include/lib/,rel:.'
139
140 au BufEnter *.cpp,*.cc,*.cxx let b:fswitchdst='h,hxx,hpp,hh'
141 au BufEnter *.h,*.hh,*.hxx let b:fswitchdst='cc,c,cxx,cpp'
142
143 :let g:org_todo_keywords = [['TODO(t)', 'WAITING(w)', '|', 'DONE(d)'],
144 \ ['|', 'OBSOLETE(o)', 'WONT(n)'],
145 \ ['CANCELED(c)']]
146
147 let g:vimwiki_list = [{'path': '~/.vimwiki/',
148 \ 'template_path': '~/.vim/vimwiki/templates',
149 \ 'template_default': 'default',
150 \ 'template_ext': '.html'}]
151
152
153 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
154
155 runtime macros.vim
156 runtime keymaps.vim
157
158 if filereadable($HOME . '/.vim/init-local.vim')
159 source ~/.vim/init-local.vim
160 endif