-
Notifications
You must be signed in to change notification settings - Fork 4
/
vimrc
380 lines (254 loc) · 10.8 KB
/
vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
" Plugin installation start {{{
call plug#begin(expand('~/.vim/bundle/'))
" General plugins; loaded for all files
Plug 'Raimondi/delimitMate'
Plug 'roman/golden-ratio'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'bitc/vim-bad-whitespace'
Plug 'altercation/vim-colors-solarized'
Plug 'kshenoy/vim-signature'
Plug 'mhinz/vim-signify'
Plug 'Valloric/YouCompleteMe', { 'do': './install.py --clang-completer' }
" Snippets plugins; also loaded for all files
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'dnivra/more-vim-snippets'
" Syntax checking
Plug 'scrooloose/syntastic', { 'for': ['c', 'cpp', 'haskell', 'python'] }
" Commenting related
Plug 'scrooloose/nerdcommenter', { 'for': ['c', 'cpp', 'haskell', 'python', 'tex'] }
" Haskell plugins
Plug 'neovimhaskell/haskell-vim', { 'for': 'haskell' }
Plug 'bitc/vim-hdevtools', { 'for': 'haskell' }
Plug 'eagletmt/neco-ghc', { 'for': 'haskell' }
Plug 'Twinside/vim-haskellFold', { 'for': 'haskell' }
" HTML plugins
Plug 'nathanaelkane/vim-indent-guides', { 'for': ['html', 'htmldjango'] }
" Markdown plugins
" TODO: Lazily load these and make them work for *.md files
Plug 'godlygeek/tabular' | Plug 'plasticboy/vim-markdown'
" Python plugins
Plug 'fisadev/vim-isort', { 'for': 'python' }
Plug 'tmhedberg/SimpylFold', { 'for': 'python' }
call plug#end()
" }}} Plugin installation end
" General configuration start {{{
" Override as needed later
set fileformat=unix
syntax on
filetype on
set ignorecase
set number
set smartcase
set encoding=utf-8
set spell spelllang=en_gb
set hlsearch
set backspace=eol,start,indent
" Be iMproved
if has('vim_starting')
set nocompatible
endif
filetype indent on
filetype plugin indent on
" Align the new line indent with the previous line
set autoindent
" Convert tabs to spaces
set expandtab
" Operation >> indents 4 columns; << unindents 4 columns
set shiftwidth=4
" Insert/delete 4 spaces when hitting a TAB/BACKSPACE
set softtabstop=4
" A hard TAB displays as 4 columns
set tabstop=4
" Shortcut to toggle paste mode
set pastetoggle=<F10>"
" Enable incremental search
set incsearch
" Set leader key to ,
let mapleader = ","
" Shortcuts for easy navigation between windows
nnoremap <A-Up> :wincmd k <CR>
nnoremap <A-Down> :wincmd j <CR>
nnoremap <A-Left> :wincmd h <CR>
nnoremap <A-Right> :wincmd l <CR>
" Set default shell to Z shell
set shell=/bin/zsh
" Set default textwidth
set textwidth=85
let g:python_host_prog = '/usr/bin/python2'
" }}} General configuration end
" Plugin configuration start {{{
" Syntastic configuration start {{{
let g:syntastic_auto_loc_list=1
let g:syntastic_check_on_open=1
" Shortcut to recompile
nnoremap <F5> :SyntasticCheck<CR>
" Shortcut to disable errors pane
nnoremap <F6> :SyntasticReset<CR>
" }}} Syntastic configuration end
" You Complete Me configuration start {{{
let g:ycm_semantic_triggers = {
\ 'c' : ['->', '.'],
\ 'cpp' : ['->', '.', '::'],
\ 'haskell, java, vim' : ['.'],
\ 'tex' : ['{']
\ }
" Close preview after completion is chosen
let g:ycm_autoclose_preview_window_after_completion = 1
" Don't ask for YCM configuration file load confirmation once
let g:ycm_confirm_extra_conf = 0
" Collect identifiers from strings and comments
let g:ycm_collect_identifiers_from_comments_and_strings = 1
" Show completion for comments
let g:ycm_complete_in_comments = 1
" Set location of configuration file
let g:ycm_global_ycm_extra_conf = '$HOME/.ycm_extra_conf.py'
" Unset blacklist
let g:ycm_filetype_blacklist = {}
" }}} You Complete Me configuration end
" delimitMate configuration start {{{
" Characters delimitMate will match
let delimitMate_matchpairs = "(:),[:],{:},<:>"
" }}} delimitMate configuration end
" nerdcommenter configuration start {{{
" Insert space after comment symbol
let NERDSpaceDelims = 1
" }}} nerdcommenter configuration end
" Solarized theme configuration start {{{
syntax enable
se t_Co=256
let g:solarized_termcolors=256
set background=dark
:silent! colorscheme solarized
" }}} Solarized theme configuration end
" vim-indent-guides configuration start {{{
" Start level for indent highlight
let g:indent_guides_start_level = 2
" Size of indent guide
let g:indent_guides_guide_size = 1
" Disable default colours
let g:indent_guides_auto_colors = 0
" Set indent highlight colours: even is RoyalBlue1, odd is Cyan1
" See http://vim.wikia.com/wiki/Xterm256_color_names_for_console_Vim for all 256 colours
autocmd VimEnter,ColorScheme * :hi IndentGuidesOdd ctermbg=51
autocmd VimEnter,ColorScheme * :hi IndentGuidesEven ctermbg=63
" }}} vim-indent-guides configuration end
" vim-signify configuration start {{{
" Highlight the changed lines
let g:signify_line_highlight = 1
" }}} vim-signify configuration end
" vim-airline configuration start {{{
set noshowmode
set laststatus=2
let g:airline#extensions#tabline#enabled=1
" }}} vim-airline configuration end
" UltiSnips configuration start {{{
let g:UltiSnipsExpandTrigger="<c-j>"
" Location where private snippets are stored
let g:UltiSnipsSnippetsDir="~/.vim/bundle/my-vim-snippets/UltiSnips"
let g:UltiSnipsEditSplit="horizontal"
" }}} UltiSnips configuration end
" }}} Plugin configuration end
" FileType configuration start {{{
" C configuration start {{{
autocmd BufNewFile,BufRead *.h set ft=c
" Enable folding
autocmd FileType c setlocal foldmethod=syntax
" Disable spell check
autocmd FileType c setlocal nospell
" }}} C configuration end
" C++ configuration start {{{
autocmd FileType cpp let b:delimitMate_matchpairs="(:),[:],{:}"
" Enable folding
autocmd FileType cpp setlocal foldmethod=syntax
" Disable spell check
autocmd FileType cpp setlocal nospell
" }}} C++ configuration end
" Python configuration start {{{
autocmd FileType python setlocal linebreak smartindent
" lines longer than 85 columns will be broken
autocmd FileType python setlocal textwidth=85
" round indent to multiple of 'shiftwidth'
autocmd FileType python setlocal shiftround
" Set syntastic checkers to be activated
let g:syntastic_python_checkers = ['python', 'flake8']
" Ignore compiled files
set wildignore+=*.pyc,*.pyo
set wildignore+=*.egg,*.egg-info
" Disable spell check in python files
autocmd FileType python setlocal spell spelllang = ""
" Disable spell check
autocmd FileType python setlocal nospell
" Do not match < or > for Python files
autocmd FileType python let b:delimitMate_matchpairs="(:),[:],{:}"
" }}} Python configuration end
" Django configuration start {{{
" Set filetype for common Django files
autocmd BufNewFile,BufRead admin.py setlocal filetype=python.django
autocmd BufNewFile,BufRead forms.py setlocal filetype=python.django
autocmd BufNewFile,BufRead local_settings.py setlocal filetype=python.django
autocmd BufNewFile,BufRead models.py setlocal filetype=python.django
autocmd BufNewFile,BufRead settings.py setlocal filetype=python.django
autocmd BufNewFile,BufRead urls.py setlocal filetype=python.django
autocmd BufNewFile,BufRead views.py setlocal filetype=python.django
autocmd BufNewFile,BufRead helper.py setlocal filetype=python.django
" Set filetype for rest_framework's files
autocmd BufNewFile,BufRead serializers.py setlocal filetype=python.django
autocmd BufNewFile,BufRead permissions.py setlocal filetype=python.django
" Enable indent highlight at startup
autocmd FileType htmldjango IndentGuidesEnable
" Disable spell check
autocmd FileType python.django setlocal nospell
autocmd FileType htmldjango setlocal nospell
" }}} Django configuration end
" Sage configuration start {{{
autocmd BufNewFile,BufRead *.sage,*.spyx,*.pyx setlocal filetype=python
" Disable spell check
autocmd FileType python setlocal nospell
" }}} Sage configuration end
" HTML configuration start {{{
" Enable indent highlight at startup
autocmd FileType html IndentGuidesEnable
" Fold based on indentation
autocmd FileType html setlocal foldmethod=indent
" }}} HTML configuration end
" jam configuration start {{{
autocmd BufRead,BufNewFile Jamfile setlocal filetype=jamfile
autocmd FileType jamfile set noexpandtab
autocmd FileType jamfile set softtabstop=8
autocmd FileType jamfile set tabstop=8
" }}} jam configuration end
" Haskell configuation start {{{
" Characters delimitMate will match
autocmd FileType haskell let delimitMate_matchpairs = "(:),[:],{:}"
" Reset shiftwidth
autocmd FileType haskell let shiftwidth=4
autocmd FileType haskell set shiftround
autocmd FileType haskell set tabstop=8
" Set textwidth to 85
autocmd FileType haskell setlocal textwidth=85
" Disable spell check
autocmd FileType haskell setlocal nospell
" Set omnifunc for completion
autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc
" hdevtools configuration
autocmd FileType haskell nnoremap <buffer> <F7> :HdevtoolsType<CR>
autocmd FileType haskell nnoremap <buffer> <silent> <F8> :HdevtoolsClear<CR>
let g:syntastic_haskell_hdevtools_args = "-g -Wall"
" }}} Haskell configuration end
" Markdown configuation start {{{
autocmd FileType markdown setlocal formatoptions-=l
" }}} Markdown configuation end
" TeX configuration start {{{
autocmd BufNewFile,BufRead *.tex setlocal filetype=tex
autocmd FileType tex setlocal shiftwidth=2
autocmd FileType tex setlocal softtabstop=2
autocmd FileType tex setlocal tabstop=2
autocmd FileType tex setlocal textwidth=85
" }}} TeX configuration end
" vimrc configuration start {{{
autocmd BufNewFile,BufRead *vimrc setlocal foldmarker={{{,}}}
autocmd BufNewFile,BufRead *vimrc setlocal foldmethod=marker
" }}} vimrc configuration end
" }}} FileType configuration end