-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
681 lines (563 loc) Β· 19.9 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
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
" Basic settings {{{
" Several basic settings and some mappings from https://github.com/gergap/vim
" Disable vi compatibility (emulation of old bugs)
set nocompatible
" set UTF-8 encoding
set encoding=utf-8
set fileencoding=utf-8
scriptencoding utf-8
set termencoding=utf-8
" Indentation settings
set autoindent " Use indentation of previous line
set smartindent " Use intelligent indentation for code
" Set tab width to 4
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab " Insert spaces instead of tabs
filetype indent plugin on
set hlsearch " Highlight search results
set incsearch " Show search matches as you type
" Color settings
set t_Co=256 " Enable 256 colors
syntax on " Enable syntax highlighting
colorscheme smkent
set number " Show line numbers
set relativenumber " Show relative line numbers (except for the current line)
set showmatch " Show matching braces
set nowrap " Don't wrap long lines
" Use one space instead of two after periods when formatting paragraphs
set nojoinspaces
" Highlight certain nonprintable characters
set list
set listchars=nbsp:Β¬,tab:Β»\ ,extends:Β»,precedes:Β«
set mouse= " Disable mouse support
set so=2 " so is "Scrolloff", or the minimum number of context
" lines that are displayed above/below the cursor.
" Enable command line completion
set wildmenu
set wildmode=longest:full,full
" Set custom timeout exiting insert mode
" The default timeout is much higher, resulting in a delay exiting insert mode
set timeout timeoutlen=1000 ttimeoutlen=50
" Disable vim requesting the terminal version
" This prevents extraneous garbage from being printed on startup
set t_RV=
" Disable swap file fsync to prevent Vim from blocking when writing swap files
set swapsync=
" Open preview splits at the bottom instead of the top
set splitbelow
" Allow execution of project-specific .vimrc files
if getcwd() != $HOME
set exrc
set secure
endif
" }}}
" Basic autocommands {{{
augroup basic_autocommands
autocmd!
" 80-character column highlight
" http://stackoverflow.com/a/3765575
if exists('+colorcolumn')
set colorcolumn=81
else
autocmd BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
endif
" Highlight trailing whitespace in red (allow per-buffer override)
" http://vim.wikia.com/wiki/VimTip396
autocmd BufWinEnter *
\ if get(b:, 'highlight_trailing_whitespace', 1) |
\ call matchadd('Error', '\s\+$', 5) |
\ endif
if version >= 702
autocmd BufWinLeave * call clearmatches()
endif
" Open help windows vertically if space permits
" Based on http://vi.stackexchange.com/a/4464
autocmd BufWinEnter *.txt if &buftype == 'help' |
\ if &columns >= 160 | wincmd H | else | wincmd K | endif | endif
augroup END
" }}}
" Keyboard mappings {{{
" Several mappings are from YADR: https://github.com/skwp/dotfiles
let mapleader=","
" http://superuser.com/a/402084
if &term =~ '^screen'
" tmux will send xterm-style keys when its xterm-keys option is on
execute "set <xUp>=\e[1;*A"
execute "set <xDown>=\e[1;*B"
execute "set <xRight>=\e[1;*C"
execute "set <xLeft>=\e[1;*D"
endif
" Resize windows with arrow keys
" Up and down are reversed compared to YADR's example
nnoremap <C-Up> <C-w>-
nnoremap <C-Down> <C-w>+
nnoremap <C-Left> <C-w><
nnoremap <C-Right> <C-w>>
" Mappings for creating splits that span an entire edge of the editor
" Idea from:
" https://technotales.wordpress.com/2010/04/29/
" vim-splits-a-guide-to-doing-exactly-what-you-want/
nnoremap <silent> <C-w>l :botright vsplit<CR>
nnoremap <silent> <C-w>j :botright split<CR>
nnoremap <silent> <C-w>h :topleft vsplit<CR>
nnoremap <silent> <C-w>k :topleft split<CR>
" Make 0 go to the first character rather than the beginning
" of the line. When we're programming, we're almost always
" interested in working with text rather than empty space. If
" you want the traditional beginning of line, use ^
nnoremap 0 ^
nnoremap ^ 0
" F2 and Ctrl+S:
" In normal mode, save the file
" In insert mode, exit insert mode, save the file, and enter insert mode
nmap <F2> :w<CR>
nmap <C-s> :w<CR>
" `^ prevents the cursor from backing up one character when exiting and
" re-entering insert mode
" http://stackoverflow.com/a/2296229
imap <F2> <ESC>:w<CR>`^i
imap <C-s> <ESC>:w<CR>`^i
" F3: Clear last search highlighting
nnoremap <silent> <F3> :noh<return><esc>
" F4: Toggle paste mode
set pastetoggle=<F4>
function! TogglePaste() abort
" Toggle paste mode
set paste!
" Enable/disable completor based on new paste state
let g:completor_auto_trigger = (1 - &paste)
endfunction
nnoremap <silent> <F4> :call TogglePaste()<CR>
" F9: Toggle spell checking
nnoremap <silent> <F9> :setlocal spell!<CR>
inoremap <F9> <ESC>:setlocal spell!<CR>`^i
" Navigate the location list using [l and ]l.
" If the location list is empty, take no action.
" If the location list is populated, open it if it was closed.
" If the cursor is not positioned on the line for the currently selected item
" in the location list, move the cursor to the currently selected item.
" Otherwise, navigate to the previous/next location list item.
" Wrap the selection when moving past the beginning/end of the location list.
function! NavigateWrapLocationList(next) " {{{
" a:next is 1 for next location, 0 for previous location
try
if a:next | lnext | else | lprev | endif
catch /E42/ " No errors
catch /E553/ " No more items
" Wrap list
if a:next | lfirst | else | llast | endif
endtry
endfunction " }}}
nmap <silent> ]l :call NavigateWrapLocationList(1)<CR>
nmap <silent> [l :call NavigateWrapLocationList(0)<CR>
" nmap <silent> ]l :lnext<CR>
" nmap <silent> [l :lprev<CR>
nmap <silent> [L :lfirst<CR>
nmap <silent> ]L :llast<CR>
" Navigate SCM conflict markers with [n and ]n.
" From vim-unimpaired: https://github.com/tpope/vim-unimpaired
" Context and ContextMotion helper functions {{{
function! Context(reverse)
call search('^\(@@ .* @@\|[<=>|]\{7}[<=>|]\@!\)', a:reverse ? 'bW' : 'W')
endfunction
function! ContextMotion(reverse)
if a:reverse
-
endif
call search('^@@ .* @@\|^diff \|^[<=>|]\{7}[<=>|]\@!', 'bWc')
if getline('.') =~# '^diff '
let end = search('^diff ', 'Wn') - 1
if end < 0
let end = line('$')
endif
elseif getline('.') =~# '^@@ '
let end = search('^@@ .* @@\|^diff ', 'Wn') - 1
if end < 0
let end = line('$')
endif
elseif getline('.') =~# '^=\{7\}'
+
let end = search('^>\{7}>\@!', 'Wnc')
elseif getline('.') =~# '^[<=>|]\{7\}'
let end = search('^[<=>|]\{7}[<=>|]\@!', 'Wn') - 1
else
return
endif
if end > line('.')
execute 'normal! V'.(end - line('.')).'j'
elseif end == line('.')
normal! V
endif
endfunction
" }}}
nmap <silent> [n :<C-U>call Context(1)<CR>
nmap <silent> ]n :<C-U>call Context(0)<CR>
omap <silent> [n :<C-U>call ContextMotion(1)<CR>
omap <silent> ]n :<C-U>call ContextMotion(0)<CR>
" Navigate tags with ]t and [t
nnoremap <silent> [t :<C-U>tprev<CR>
nnoremap <silent> ]t :<C-U>tnext<CR>
nnoremap <silent> [T :<C-U>tfirst<CR>
nnoremap <silent> ]T :<C-U>tlast<CR>
" Remap record (q) to ,q so q can be used to quit vim
nnoremap <Leader>q q
" Remap Ctrl+e and Ctrl+y so they can be used elsewhere
nnoremap <Leader>e <C-e>
nnoremap <Leader>y <C-y>
" Paste from the system clipboard with ,p and ,P
nnoremap <Leader>p "+p
nnoremap <Leader>P "+Pl
" Surround shortcuts
map <Leader>' ysiW'
vmap <Leader>' c'<C-R>"'<ESC>
map <Leader>" ysiW"
vmap <Leader>" c"<C-R>""<ESC>
" ,) or ,( Surround a word with (parens)
" The difference is in whether a space is put in
map <Leader>( ysiw(
map <Leader>) ysiw)
vmap <Leader>( c( <C-R>" )<ESC>
vmap <Leader>) c(<C-R>")<ESC>
" ,[ Surround a word with [brackets]
map <Leader>] ysiw]
map <Leader>[ ysiw[
vmap <Leader>[ c[ <C-R>" ]<ESC>
vmap <Leader>] c[<C-R>"]<ESC>
" ,{ Surround a word with {braces}
map <Leader>} ysiw}
map <Leader>{ ysiw{
vmap <Leader>} c{ <C-R>" }<ESC>
vmap <Leader>{ c{<C-R>"}<ESC>
" ,` Surround a word with `backticks`
map <Leader>` ysiw`
" Surround contents replacement shortcuts
nnoremap <Leader>r' f'ci'
nnoremap <Leader>r" f"ci"
nnoremap <Leader>r` f`ci`
nnoremap <Leader>r( f(ci(
nnoremap <Leader>r) f)ci)
nnoremap <Leader>r[ f[ci[
nnoremap <Leader>r] f]ci]
nnoremap <Leader>r{ f{ci{
nnoremap <Leader>r} f}ci}
" Break current line at cursor, removing any trailing whitespace
nmap <Leader>s i<CR><Esc>k:silent! s/\s\+$//<CR>:noh<CR>$
" Insert blank lines above or below with [<Space> or ]<Space>
" From vim-unimpaired: https://github.com/tpope/vim-unimpaired
" BlankUp and BlankDown helper functions {{{
function! BlankUp(count) abort
put!=repeat(nr2char(10), a:count)
']+1
endfunction
function! BlankDown(count) abort
put =repeat(nr2char(10), a:count)
'[-1
endfunction
" }}}
nmap [<Space> :<C-U>call BlankUp(v:count1)<CR>
nmap ]<Space> :<C-U>call BlankDown(v:count1)<CR>
" Confirm and quit using q in normal mode
nnoremap <silent> q :conf q<cr>
" Remap Q to save and quit. This also disables Ex mode.
nnoremap <silent> Q :wq<cr>
" Use ,W to save the current file with sudo
nnoremap <Leader>W :w !sudo tee > /dev/null %<CR>
" Show the current buffer name in the status bar with <Leader>f
nnoremap <Leader>f :echo @%<CR>
" Show the current buffer's absolute path in the status bar with <Leader>F
nnoremap <Leader>F :echo expand('%:p')<CR>
" Redraw the screen with <Leader>.
nnoremap <silent> <Leader>. :redraw!<CR>
" }}}
" Plugin installation {{{
" Define list of plugins to be installed
silent call plug#begin() " Suppress error message if git is not installed
Plug 'https://github.com/cespare/vim-toml',
\ { 'branch': 'main' }
Plug 'https://github.com/christoomey/vim-tmux-navigator'
Plug 'https://github.com/ctrlpvim/ctrlp.vim'
Plug 'https://github.com/davidhalter/jedi-vim'
Plug 'https://github.com/dense-analysis/ale'
Plug 'https://github.com/fatih/vim-go',
\ { 'do': ':GoUpdateBinaries' }
Plug 'https://github.com/HerringtonDarkholme/yats.vim'
Plug 'https://github.com/honza/vim-snippets'
Plug 'https://github.com/hynek/vim-python-pep8-indent'
Plug 'https://github.com/jamessan/vim-gnupg',
\ { 'branch': 'main' }
Plug 'https://github.com/jeffkreeftmeijer/vim-numbertoggle'
Plug 'https://github.com/junegunn/fzf',
\ {
\ 'dir': '~/.fzf',
\ 'do': './install --completion --no-update-rc --no-key-bindings',
\ }
Plug 'https://github.com/junegunn/fzf.vim'
if v:version >= 704
Plug 'https://github.com/ludovicchabant/vim-gutentags'
endif
Plug 'https://github.com/maralla/completor.vim'
Plug 'https://github.com/maxmellon/vim-jsx-pretty'
Plug 'https://github.com/pangloss/vim-javascript'
Plug 'https://github.com/ruanyl/vim-gh-line'
Plug 'https://github.com/sirtaj/vim-openscad'
Plug 'https://github.com/SirVer/ultisnips'
Plug 'https://github.com/smkent/vim-pipe-preview',
\ { 'branch': 'main' }
Plug 'https://github.com/stephpy/vim-yaml'
Plug 'https://github.com/tomtom/tcomment_vim'
Plug 'https://github.com/tpope/vim-dispatch'
Plug 'https://github.com/tpope/vim-fugitive'
Plug 'https://github.com/tpope/vim-surround'
Plug 'https://github.com/vim-airline/vim-airline'
Plug 'https://github.com/vim-scripts/AnsiEsc.vim'
" vim-gitgutter with real-time sign updates enabled occasionally produced
" rendering errors prior to Vim 7.4.427. For more information, see:
" - https://github.com/airblade/vim-gitgutter/issues/171
" - http://ftp.vim.org/vim/patches/7.4/7.4.427
if executable('git')
if has('patch-7.4.427')
Plug 'https://github.com/airblade/vim-gitgutter',
\ { 'branch': 'main' }
" Reduce default refresh time from 4 seconds to 0.25 seconds
set updatetime=250
else
Plug 'https://github.com/mhinz/vim-signify'
endif
endif
call plug#end()
" Install plugins automatically if needed and if VIM_SKIP_PLUGINS is unset or 0
if empty($VIM_SKIP_PLUGINS) || $VIM_SKIP_PLUGINS == 0
if !empty(filter(copy(g:plugs), '!isdirectory(v:val.dir)'))
if executable('git')
PlugInstall | q
endif
endif
endif
" }}}
" vim-airline configuration {{{
set laststatus=2 " Always show the status bar
set noshowmode " vim-airline already shows the current mode
" Enable powerline fonts unless explicitly disabled
if empty($VIM_AIRLINE) || $VIM_AIRLINE != 0
let g:airline_powerline_fonts = 1
else
let g:airline_powerline_fonts = 0
" Use spaces instead of carats if custom fonts are disabled
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_left_sep=' '
let g:airline_right_sep=' '
let g:airline_left_alt_sep=' '
let g:airline_right_alt_sep=' '
endif
" Set vim-airline color theme to smkent
let g:airline_theme = "smkent"
" Set custom airline symbols
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_symbols.linenr = 'ξ‘'
" Customize right statusbar section contents
let g:airline_section_x = airline#section#create_right(
\ ['tagbar', 'filetype', 'ffenc'])
let g:airline_section_y = airline#section#create(['%3p%%'])
let g:airline_section_z = airline#section#create(['linenr', ':%3c '])
" }}}
" vim-signify configuration {{{
let g:signify_vcs_list = [ 'git' ]
" Map [c and ]c shortcuts to jump between hunks
let g:signify_mapping_next_hunk = ']c'
let g:signify_mapping_prev_hunk = '[c'
" vim-signify integration with vim-airline
" Only show modified counts in the status bar if they're non zero
let g:airline#extensions#hunks#non_zero_only = 1
let g:signify_sign_add = '+'
let g:signify_sign_delete = '<'
let g:signify_sign_change = '|'
let g:signify_sign_delete_first_line = '^^'
let g:signify_sign_changedelete = g:signify_sign_change . g:signify_sign_delete
" }}}
" vim-gitgutter configuration {{{
" Customize sign characters
let g:gitgutter_highlight_lines = 0
let g:gitgutter_sign_added = '+'
let g:gitgutter_sign_removed = '<'
let g:gitgutter_sign_modified = '|'
let g:gitgutter_sign_removed_first_line = '^^'
let g:gitgutter_sign_modified_removed =
\ g:gitgutter_sign_modified . g:gitgutter_sign_removed
" Customize sign column highlight
" Highlight groups are located in my color scheme file
" See the section "Plugin highlight groups" in that file
let g:gitgutter_override_sign_column_highlight = 0
" }}}
" fzf configuration {{{
nnoremap <silent> <C-e> :Buffers<CR>
nnoremap <silent> <C-@> :Tags<CR>
nnoremap <silent> <C-p> :GFiles<CR>
nnoremap <silent> <Leader>o :History<CR>
let g:fzf_colors = {
\ 'pointer': ['fg', 'Title'],
\ 'spinner': ['fg', 'Constant'],
\ }
" }}}
" CtrlP configuration {{{
let g:ctrlp_map = '<Leader><Leader>p'
let g:ctrlp_cmd = 'CtrlPMixed'
let g:ctrlp_max_depth = 5
let g:ctrlp_max_files = 30000
let g:ctrlp_show_hidden = 1
let g:ctrlp_clear_cache_on_exit = 0
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
let g:ctrlp_user_command = {
\ 'types': {
\ 1: ['.git', 'cd %s && git ls-files . -co --exclude-standard'],
\ },
\ 'fallback': 'find %s -type f'
\ }
" }}}
" ALE configuration {{{
" Basic settings
let g:ale_open_list = 0
let g:airline#extensions#ale#enabled = 1
let g:ale_fix_on_save = 1
" Sign column symbols
let g:ale_sign_error = "β" " Block X
let g:ale_sign_warning = "β " " Warning sign symbol
let g:ale_sign_style_error = "β’" " Dotted right arrow
let g:ale_sign_style_warning = g:ale_sign_style_error
" Linters and fixers
let g:ale_python_black_auto_poetry = 1
let g:ale_python_flake8_auto_poetry = 1
let g:ale_python_isort_auto_poetry = 1
let g:ale_python_mypy_auto_poetry = 1
let g:ale_fixers = {
\ 'python': ['black', 'isort'],
\ }
let g:ale_python_black_options = "-l 79"
" ALE control mappings
" Functions to control ALE on a per-buffer basis {{{
function! ALEToggleEnabled()
" Idea from http://stackoverflow.com/a/36683733
if &filetype == 'qf'
" The location window is focused. Close it so this action will apply
" to the corresponding buffer.
lclose | lclose
endif
ALEToggleBuffer
echo 'ALE ' .
\ (get(b:, 'ale_enabled', 1) == 1 ? 'enabled' : 'disabled') .
\ ' for "' . @% . '"'
endfunction
function! ALEToggleVerbosity()
if &filetype == 'qf'
" The location window is focused. Close it so this action will apply
" to the corresponding buffer.
lclose | lclose
endif
let b:ale_quiet = 1 - get(b:, 'ale_quiet', 0)
if b:ale_quiet == 0
let b:ignore_arg_ale_python_flake8 = ''
else
let b:ignore_arg_ale_python_flake8 = '--ignore=W,E,F4'
endif
let b:ale_python_flake8_options =
\ get(b:, 'base_ale_python_flake8_options', '') . ' ' .
\ b:ignore_arg_ale_python_flake8
ALELint
echo 'ALE verbosity ' .
\ (empty(b:ignore_arg_ale_python_flake8) ? 'increased' : 'reduced') .
\ ' for "' . @% . '"'
endfunction
function! ToggleLocationList()
let l:old_last_winnr = winnr('$')
lclose | lclose
if l:old_last_winnr == winnr('$')
" Nothing was closed, open ALE error location panel
if len(getloclist(winnr('$')))
lopen
endif
endif
endfunction
" }}}
nmap <silent> <Leader>l :call ToggleLocationList()<CR>
nmap <silent> <Leader>d :call ALEToggleEnabled()<CR>
nmap <silent> <C-y> :call ALEToggleVerbosity()<CR>
nnoremap <F10> :ALEFix<CR>
" }}}
" tcomment configuration {{{
" By default, tcomment's gcc mapping uses the count to repeat the comment
" instead of commenting out the specified number of lines. This configuration
" uses the count with gcc to toggle comments for the specified number of
" lines instead.
" https://github.com/tomtom/tcomment_vim/issues/105
"
" Override default gc[...] mappings
let g:tcomment_opleader1 = ''
" Default gc mappings that should be kept
nmap <silent> gc <Plug>TComment_gc
nmap <silent> gcb <Plug>TComment_gcb
xmap gc <Plug>TComment_gc
" Custom gc mappings
nmap <silent> gcc :TComment<CR>
" }}}
" AnsiEsc configuration {{{
" Remove unwanted mappings
augroup AnsiEsc_unmap_autocommands
autocmd!
autocmd VimEnter *
\ execute 'nunmap <Leader>swp' |
\ execute 'nunmap <Leader>rwp'
augroup END
" }}}
" vim-pipe-preview configuration {{{
" Preview markdown files using mdv with the "Marieke" color theme
let g:pipe_preview_markdown_command = 'mdv -t "960.847" -'
nnoremap <silent> <Leader>mn :<C-U>PipePreview<CR>
nnoremap <silent> <Leader>mu :<C-U>PipePreviewUpdate<CR>
" }}}
" vim-gutentags configuration {{{
if !executable('ctags')
let g:gutentags_enabled = 0
endif
let g:gutentags_generate_on_new = 0
let g:gutentags_ctags_tagfile = '.tags'
let g:gutentags_project_root = ['.tags', 'tags']
let g:gutentags_file_list_command = {
\ 'markers': {
\ '.git': 'git ls-files -co --exclude-standard',
\ '.hg': 'hg locate',
\ },
\ }
let g:gutentags_generate_on_empty_buffer = 1
" }}}
" ultisnips configuration {{{
let g:UltiSnipsEditSplit="vertical"
let g:UltiSnipsExpandTrigger="<c-j>"
" }}}
" Autocompletion configuration (jedi-vim and completor) {{{
let g:jedi#show_call_signatures_delay = 100
nnoremap <silent> <C-]> :call jedi#goto()<CR>
let g:completor_auto_trigger = 1
" From the completor README:
" https://github.com/maralla/completor.vim#use-tab-to-trigger-completion-disable-auto-trigger
function! Tab_Or_Complete() abort
" If completor is already open the `tab` cycles through suggested completions.
if pumvisible()
return "\<C-N>"
" If completor is not open and we are in the middle of typing a word then
" `tab` opens completor menu.
elseif col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w'
return "\<C-R>=completor#do('complete')\<CR>"
else
" If we aren't typing a word and we press `tab` simply do the normal `tab`
" action.
return "\<Tab>"
endif
endfunction
inoremap <expr> <Tab> Tab_Or_Complete()
" }}}
" vim: set fdls=0 fdm=marker: