forked from twpayne/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_vimrc.tmpl
315 lines (281 loc) · 15.5 KB
/
dot_vimrc.tmpl
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
call plug#begin()
Plug '/usr/local/opt/fzf'
Plug 'AndrewRadev/splitjoin.vim'
Plug 'HerringtonDarkholme/yats.vim'
Plug 'airblade/vim-gitgutter'
Plug 'cespare/vim-toml'
Plug 'exu/pgsql.vim'
Plug 'fatih/vim-go'
Plug 'google/vim-maktaba'
Plug 'junegunn/fzf.vim'
Plug 'keithluchtel/vim-monkey-c'
Plug 'majutsushi/tagbar'
Plug 'michaeljsmith/vim-indent-object'
Plug 'mileszs/ack.vim'
Plug 'tomasr/molokai'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-rhubarb'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-unimpaired'
Plug 'twpayne/vim-igc'
Plug 'twpayne/vim-plugin-branchconfig'
Plug 'twpayne/vim-testscript'
Plug 'vim-airline/vim-airline'
" github.com/junegunn/fzf.vim
nmap ;b :Buffers<CR>
nmap ;f :Files<CR>
nmap ;t :Tags<CR>
call plug#end()
set backspace=indent,eol,start
set nobackup
set nocompatible
set cursorline
set directory=~/tmp,/var/tmp,/tmp,.
set encoding=utf-8
set guioptions=acig
set hidden
set lazyredraw
set list
set listchars=tab:↦\ ,trail:·
set ruler
set scrolloff=3
set shortmess=atI
set showcmd
set showmatch
set wildmenu
set wildmode=list:longest
if has('gui_running')
set background=dark
colorscheme molokai
endif
{{ if eq .chezmoi.os "darwin" -}}
if has('gui_macvim')
set guifont=Menlo:h12
set laststatus=2
set showtabline=2
set noshowmode
set visualbell
endif
{{ end -}}
filetype on
filetype indent on
filetype plugin on
syntax on
nmap <F1> nop
nnoremap j gj
nnoremap k gk
nnoremap <silent> <leader>s :set nolist!<CR>
nnoremap <silent> zj o<Esc>
nnoremap <silent> zk O<Esc>
inoremap <Leader>{ {<CR>}<Esc>O
inoremap <Leader>} {<CR>},<Esc>O
inoremap <Leader>( ()<Esc>i
inoremap <Leader>[ []<Esc>i
au FileType c,cpp setlocal softtabstop=4 shiftwidth=4 tabstop=4
au FileType c,cpp inoremap <buffer> <Leader>br break;<CR>
au FileType c,cpp inoremap <buffer> <Leader>ca case<Space>0:<CR>break;<Esc>k$hcw
au FileType c,cpp inoremap <buffer> <Leader>co continue;<CR>
au FileType c,cpp inoremap <buffer> <Leader>de default:<CR>break;<Esc>O
au FileType c,cpp inoremap <buffer> <Leader>ei }<Space>else<Space>if<Space>()<Space>{<Esc>F(a
au FileType c,cpp inoremap <buffer> <Leader>el }<Space>else<Space>{<CR>
au FileType c,cpp inoremap <buffer> <Leader>en enum<Space><Space>{<CR>};<Esc>k$hi
au FileType c,cpp inoremap <buffer> <Leader>ie if<Space>()<Space>{<CR>}<Space>else<Space>{<CR>}<Esc>kk$F(a
au FileType c,cpp inoremap <buffer> <Leader>if if<Space>()<Space>{<CR>}<Esc>k$F(a
au FileType c,cpp inoremap <buffer> <Leader>fo for<Space>()<Space>{<CR>}<Esc>k$F(a
au FileType c,cpp inoremap <buffer> <Leader>re return;<Esc>i
au FileType c,cpp inoremap <buffer> <Leader>sw switch<Space>()<Space>{<CR>}<Esc>k$F(a
au FileType c,cpp inoremap <buffer> <Leader>st struct<Space>{<CR>};<Esc>k$i
au FileType c,cpp inoremap <buffer> <Leader>ty typedef<Space>
au FileType c,cpp inoremap <buffer> <Leader>wh while<Space>()<Space>{<CR>}<Esc>k$F(a
au FileType c,cpp inoremap <buffer> <Leader>#d #define<Space>
au FileType c,cpp inoremap <buffer> <Leader>#i #include<Space><><Esc>i
au FileType cpp inoremap <buffer> <Leader>cl class<Space><Space>{<CR>};<Esc>k$hi
au FileType cpp inoremap <buffer> <Leader>ra raise<Space>;<Esc>i
au FileType cpp inoremap <buffer> <Leader>tc try<Space>{<CR>}<Space>catch<Space>()<Space>{<CR>}<Esc>kO
au FileType gitcommit setlocal spell spelllang=en
let g:go_auto_sameids = 1
let g:go_auto_type_info = 1
let g:go_fmt_command = 'goimports'
let g:go_highlight_build_constraints = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_generate_tags = 1
let g:go_highlight_methods = 1
let g:go_highlight_operators = 1
let g:go_highlight_structs = 1
let g:go_highlight_structs = 1
let g:go_highlight_types = 1
let g:go_template_use_pkg = 1
au FileType go setlocal noexpandtab nolist shiftwidth=4 softtabstop=4 tabstop=4
au FileType go compiler go
au FileType go inoremap <buffer> <Leader>br break<CR>
au FileType go inoremap <buffer> <Leader>ca case<Space>:<Esc>i
au FileType go inoremap <buffer> <Leader>ch chan
au FileType go inoremap <buffer> <Leader>co const
au FileType go inoremap <buffer> <Leader>de default:<CR>
au FileType go inoremap <buffer> <Leader>ei }<Space>else<Space>if<Space><Space>{<Esc>hi
au FileType go inoremap <buffer> <Leader>el }<Space>else<Space>{<CR>
au FileType go inoremap <buffer> <Leader>fa fallthrough
au FileType go inoremap <buffer> <Leader>fe func<Space>()<Space>error<Space>{<CR>}<Esc>k$F(i
au FileType go inoremap <buffer> <Leader>fo for<Space><Space>{<CR>}<Esc>k$hi
au FileType go inoremap <buffer> <Leader>fu func<Space>()<Space>{<CR>}<Esc>k$F(i
au FileType go inoremap <buffer> <Leader>if if<Space><Space>{<CR>}<Esc>k$hi
au FileType go inoremap <buffer> <Leader>im import<Space>
au FileType go inoremap <buffer> <Leader>i" import<Space>""<Esc>i
au FileType go inoremap <buffer> <Leader>i( import<Space>(<CR>)<Esc>O""<Esc>i
au FileType go inoremap <buffer> <Leader>in interface
au FileType go inoremap <buffer> <Leader>ma make()<Esc>i
au FileType go inoremap <buffer> <Leader>pa package<Space>
au FileType go inoremap <buffer> <Leader>ra range<Space>
au FileType go inoremap <buffer> <Leader>re return
au FileType go inoremap <buffer> <Leader>se select<Space><Space>{<CR>}<Esc>k$hi
au FileType go inoremap <buffer> <Leader>sw switch<Space><Space>{<CR>}<Esc>k$hi
au FileType go inoremap <buffer> <Leader>st struct<Space>
au FileType go inoremap <buffer> <Leader>ty type<Space>
au FileType go inoremap <buffer> <Leader>va var<Space>
" run :GoBuild or :GoTestCompile based on the go file
function! s:build_go_files()
let l:file = expand('%')
if l:file =~# '^\f\+_test\.go$'
call go#test#Test(0, 1)
elseif l:file =~# '^\f\+\.go$'
call go#cmd#Build(0)
endif
endfunction
au FileType go nmap <leader>b :<C-u>call <SID>build_go_files()<CR>
au FileType go nmap <Leader>c <Plug>(go-coverage-toggle)
au FileType go nmap <leader>r <Plug>(go-run)
au FileType go nmap <leader>t <Plug>(go-test)
au Filetype go command! -bang A call go#alternate#Switch(<bang>0, 'edit')
au Filetype go command! -bang AV call go#alternate#Switch(<bang>0, 'vsplit')
au Filetype go command! -bang AS call go#alternate#Switch(<bang>0, 'split')
au Filetype go command! -bang AT call go#alternate#Switch(<bang>0, 'tabe')
au FileType haskell setlocal autoindent colorcolumn=80 expandtab shiftwidth=2 softtabstop=4 tabstop=4
au FileType html setlocal noautoindent expandtab indentexpr= shiftwidth=2 softtabstop=2 tabstop=2
au FileType lua setlocal autoindent shiftwidth=2 softtabstop=2 tabstop=8
au FileType java setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=8
au FileType java inoremap <buffer> <Leader>cl class<Space><Space>{<CR>}<Esc>k$hi
au FileType java inoremap <buffer> <Leader>ei }<Space>else<Space>if<Space>()<Space>{<Esc>F(a
au FileType java inoremap <buffer> <Leader>el }<Space>else<Space>{<CR>
au FileType java inoremap <buffer> <Leader>fo for<Space>()<Space>{<CR>}<Esc>k$F(a
au FileType java inoremap <buffer> <Leader>if if<Space>()<Space>{<CR>}<Esc>k$F(a
au FileType java inoremap <buffer> <Leader>im import<Space>;<Esc>i
au FileType java inoremap <buffer> <Leader>pi private<Space>
au FileType java inoremap <buffer> <Leader>po protected<Space>
au FileType java inoremap <buffer> <Leader>pu public<Space>
au FileType java inoremap <buffer> <Leader>re return<Space>;<Esc>i
au FileType java inoremap <buffer> <Leader>wh while<Space>()<Space>{<CR>}<Esc>k$F(a
au FileType javascript setlocal colorcolumn=80 expandtab keywordprg=cq\ -s shiftwidth=2 softtabstop=2 tabstop=8
au FileType javascript nnoremap <Leader>8 80\|F<Space>cl<CR><Esc>
au FileType javascript inoremap <buffer> <Leader>/t /**<Space>@type<Space>{}<Space>*/<Esc>F{a
au FileType javascript inoremap <buffer> <Leader>Fu function<Space>()<Space>{<CR>}<Esc>k$F(i
au FileType javascript inoremap <buffer> <Leader>be beforeEach(function()<space>{<Enter>});<Esc>O
au FileType javascript inoremap <buffer> <Leader>br break;<CR>
au FileType javascript inoremap <buffer> <Leader>cn @const
au FileType javascript inoremap <buffer> <Leader>co @constructor
au FileType javascript inoremap <buffer> <Leader>de @define<Space>{}<Esc>i
au FileType javascript inoremap <buffer> <Leader>ds describe('',<Space>function()<space>{<Enter>});<Esc>kf'a
au FileType javascript inoremap <buffer> <Leader>ei }<Space>else<Space>if<Space>()<Space>{<Esc>F(a
au FileType javascript inoremap <buffer> <Leader>el }<Space>else<Space>{<CR>
au FileType javascript inoremap <buffer> <Leader>en @enum<Space>{}<Esc>i
au FileType javascript inoremap <buffer> <Leader>ex @extends<Space>{}<Esc>i
au FileType javascript inoremap <buffer> <Leader>f, function()<Space>{<CR>},<Esc>k$F(a
au FileType javascript inoremap <buffer> <Leader>f; function()<Space>{<CR>};<Esc>k$F(a
au FileType javascript inoremap <buffer> <Leader>ff function()<Space>{};<Esc>F(a
au FileType javascript inoremap <buffer> <Leader>fo for<Space>()<Space>{<CR>}<Esc>k$F(a
au FileType javascript inoremap <buffer> <Leader>fu function()<Space>{<CR>}<Esc>k$F(a
au FileType javascript inoremap <buffer> <Leader>ga goog.asserts.assert();<Esc>F(a
au FileType javascript inoremap <buffer> <Leader>gb goog.base(this);<Esc>F)i
au FileType javascript inoremap <buffer> <Leader>gep <Esc>?}<CR>%^"jyt<Space>f{%ogoog.exportProperty(<CR><C-R>j,<CR><C-R>j);<Esc>k$i'<Esc>F.cl,<CR>'<Esc>2ji
au FileType javascript inoremap <buffer> <Leader>ges goog.exportSymbol('', );<Esc>F'i
au FileType javascript inoremap <buffer> <Leader>gi goog.inherits();<Esc>F(a
au FileType javascript inoremap <buffer> <Leader>gid goog.isDef()<Esc>F(a
au FileType javascript inoremap <buffer> <Leader>gidn goog.isDefAndNotNull()<Esc>F(a
au FileType javascript inoremap <buffer> <Leader>gin goog.isNull()<Esc>F(a
au FileType javascript inoremap <buffer> <Leader>gp goog.provide('');<Esc>F'i
au FileType javascript inoremap <buffer> <Leader>gr goog.require('');<Esc>F'i
au FileType javascript inoremap <buffer> <Leader>id @inheritDoc
au FileType javascript inoremap <buffer> <Leader>if if<Space>()<Space>{<CR>}<Esc>k$F(a
au FileType javascript inoremap <buffer> <Leader>im @implements<Space>{}<Esc>i
au FileType javascript inoremap <buffer> <Leader>in @interface
au FileType javascript inoremap <buffer> <Leader>it it('',<Space>function()<space>{<Enter>});<Esc>kf'a
au FileType javascript inoremap <buffer> <Leader>le @lends<Space>{}<Esc>i
au FileType javascript inoremap <buffer> <Leader>li @license
au FileType javascript inoremap <buffer> <Leader>no @nosideeffects
au FileType javascript inoremap <buffer> <Leader>ov @override
au FileType javascript inoremap <buffer> <Leader>pa @param<Space>{}<Esc>i
au FileType javascript inoremap <buffer> <Leader>pi @private
au FileType javascript inoremap <buffer> <Leader>po @protected
au FileType javascript inoremap <buffer> <Leader>pr prototype
au FileType javascript inoremap <buffer> <Leader>re @return<Space>{}<Esc>i
au FileType javascript inoremap <buffer> <Leader>rt return
au FileType javascript inoremap <buffer> <Leader>tc /**<Space>@type<Space>{}<Space>*/<Esc>F{a
au FileType javascript inoremap <buffer> <Leader>td @typedef<Space>{}<Esc>i
au FileType javascript inoremap <buffer> <Leader>te @template
au FileType javascript inoremap <buffer> <Leader>th @this<Space>{}<Esc>i
au FileType javascript inoremap <buffer> <Leader>tr try<Space>{<CR>}<Space>catch<Space>(e)<Space>{<CR>}<Esc>kko
au FileType javascript inoremap <buffer> <Leader>ty @type<Space>{}<Esc>i
au FileType javascript inoremap <buffer> <Leader>wh while<Space>()<Space>{<CR>}<Esc>k$F(a
au FileType javascript inoremap <buffer> <Leader>xp @expose
au FileType make setlocal softtabstop=8 shiftwidth=8 tabstop=8
au FileType perl setlocal shiftwidth=4 softtabstop=4 tabstop=8
au FileType perl inoremap <buffer> <Leader>#! #!/usr/bin/perl<CR>
au FileType perl inoremap <buffer> <Leader>ei }<Space>elsif<Space>()<Space>{<Esc>F(a
au FileType perl inoremap <buffer> <Leader>el }<Space>else<Space>{<CR>
au FileType perl inoremap <buffer> <Leader>ie if<Space>()<Space>{<CR>}<Space>else<Space>{<CR>}<Esc>kk$F(a
au FileType perl inoremap <buffer> <Leader>if if<Space>()<Space>{<CR>}<Esc>k$F(a
au FileType perl inoremap <buffer> <Leader>fe foreach<Space><Space>()<Space>{<CR>}<Esc>k$F(hi
au FileType perl inoremap <buffer> <Leader>fo for<Space>()<Space>{<CR>}<Esc>k$F(a
au FileType perl inoremap <buffer> <Leader>my my<Space>();<Esc>F(a
au FileType perl inoremap <buffer> <Leader>m@ my<Space>()<Space>=<Space>@_;<Esc>F(a
au FileType perl inoremap <buffer> <Leader>od <Esc>^ywo<Tab>or<space>die("$ProgramName:<Space><Esc>pA:<Space>$!\\n");<CR>
au FileType perl inoremap <buffer> <Leader>ou our<Space>();<Esc>F(a
au FileType perl inoremap <buffer> <Leader>qw qw()<Esc>i
au FileType perl inoremap <buffer> <Leader>re return();<Esc>F(a
au FileType perl inoremap <buffer> <Leader>sm sub<Space><Space>:<Space>method<Space>{<CR>}<Esc>k$F:hi
au FileType perl inoremap <buffer> <Leader>su sub<Space><Space>()<Space>{<CR>}<Esc>k$F(hi
au FileType perl inoremap <buffer> <Leader>un unless<Space>()<Space>{<CR>}<Esc>k$F(a
au FileType perl inoremap <buffer> <Leader>uc use<Space>constant<Space><Space>=><Space>;<Esc>4hi
au FileType perl inoremap <buffer> <Leader>us use<Space>;<Esc>i
au FileType perl inoremap <buffer> <Leader>wh while<Space>()<Space>{<CR>}<Esc>k$F(a
au FileType perl inoremap <buffer> <Leader># #<CR><CR><Esc>kA<Space>
au FileType php setlocal indentexpr= shiftwidth=4 softtabstop=4 tabstop=8
au FileType pod setlocal textwidth=80
au FileType proto setlocal shiftwidth=2 softtabstop=2 tabstop=8
au FileType python setlocal expandtab softtabstop=4 shiftwidth=4 tabstop=8
au FileType python inoremap <buffer> <Leader>fr from<Space><Space>import<Space><Esc>bhi
au FileType python inoremap <buffer> <Leader>im import<Space>
au FileType ruby setlocal expandtab shiftwidth=2 softtabstop=2 tabstop=8
au FileType ruby inoremap <buffer> <Leader>#! #!/usr/bin/ruby<CR>
au FileType ruby inoremap <buffer> <Leader>aa attr_accessor<Space>:
au FileType ruby inoremap <buffer> <Leader>ar attr_reader<Space>:
au FileType ruby inoremap <buffer> <Leader>aw attr_writer<Space>:
au FileType ruby inoremap <buffer> <Leader>ca case<Space><CR>end<Esc>kA
au FileType ruby inoremap <buffer> <Leader>ce class_eval<Space>do<CR>end<Esc>O
au FileType ruby inoremap <buffer> <Leader>cl class<Space><CR>end<CR><Esc>kkA
au FileType ruby inoremap <buffer> <Leader>cs class<Space><<<Space>self<CR>end<CR><Esc>kO
au FileType ruby inoremap <buffer> <Leader>de def<Space><CR>end<CR><Esc>kkA
au FileType ruby inoremap <buffer> <Leader>di def<Space>initialize<CR>end<CR><Esc>kkA
au FileType ruby inoremap <buffer> <Leader>do do<CR>end<Esc>kA
au FileType ruby inoremap <buffer> <Leader>d\| do<Space>\|\|<CR>end<Esc>k$i
au FileType ruby inoremap <buffer> <Leader>ea each<Space>do<Space>\|\|<CR>end<Esc>k$i
au FileType ruby inoremap <buffer> <Leader>ie if<Space><CR>else<CR>end<Esc>kkA
au FileType ruby inoremap <buffer> <Leader>if if<Space><CR>end<Esc>kA
au FileType ruby inoremap <buffer> <Leader>in instance_eval<Space>do<CR>end<Esc>O
au FileType ruby inoremap <buffer> <Leader>la lambda<Space>do<CR>end<Esc>O
au FileType ruby inoremap <buffer> <Leader>lo loop<Space>do<CR>end<Esc>O
au FileType ruby inoremap <buffer> <Leader>mo module<Space><CR>end<CR><Esc>kkA
au FileType ruby inoremap <buffer> <Leader>re require<Space>''<Esc>i
au FileType ruby inoremap <buffer> <Leader>wh while<Space><CR>end<Esc>kA
au FileType sql setlocal expandtab shiftwidth=8 softtabstop=8 tabstop=8
au FileType yaml setlocal expandtab shiftwidth=2 softtabstop=2 tabstop=8
au BufNewFile,BufRead *.kml setf xml
au BufNewFile,BufRead *.template setf json
au BufNewFile,BufRead DEFS setf python
au BufNewFile,BufRead *Jenkinsfile setf groovy
let g:LustyJugglerSuppressRubyWarning = 1
let g:sql_type_default = 'pgsql'
" vim: set filetype=vim: