-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvimrc
More file actions
executable file
·419 lines (356 loc) · 11.7 KB
/
vimrc
File metadata and controls
executable file
·419 lines (356 loc) · 11.7 KB
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
" -----------------------------------------------
" dphase's .vimrc
" (C) 2004 Joshua Deere - joshua.deere@gmail.com
" -----------------------------------------------
filetype plugin on
filetype plugin indent on
syntax on
filetype indent on
runtime! macros/matchit.vim
set foldmethod=marker
set smartindent
set smarttab
set autoindent
set noinsertmode
set backspace=2
set ruler
set showcmd
set laststatus=2
set expandtab
set vb
set number
set cursorline
" set re=1 " use pre 7.4 regex engine until it parses erb better
set t_Co=256
set autoread
set clipboard=unnamed
set printfont=Monaco:h13
set tags+=gems.tags
" pathogen
execute pathogen#infect('bundle/{}')
execute pathogen#helptags()
if has('gui_running')
set background=dark
" colorscheme base16-dphase
let g:seoul256_background = 234
colorscheme seoul256
else
set background=dark
colorscheme base16-dphase
endif
" color columns after 93 chars
set colorcolumn=93
" make code tabbing more sane
set tabstop=2
set shiftwidth=2
" persistent undo
set undodir=~/.vim/undodir
set undofile
" backup dir
set backupdir=~/.vim/sessions
set dir=~/.vim/sessions
" session
set ssop-=options
" hilight search
set hlsearch
set incsearch
" set showmatch
set ignorecase
set smartcase
nnoremap <leader><space> :nohlsearch<CR>
" This unsets the "last search pattern" register by hitting return
nnoremap <CR> :noh<CR><CR>
" open my outliner
nnoremap <silent><leader>T :e /Users/dphase/Dropbox/TODO.otl<CR>
" CSV Viewing/Editing
" let g:csv_autocmd_arrange = 1
"
aug CSVNoWrap
au!
au BufRead *.csv :set nowrap
aug end
" read .json as js
" au BufNewFile,BufRead *.json setf javascript
" no format on middle click pasting
map <MouseMiddle> <Esc>"*p
" syntastic settings
let g:syntastic_enable_balloons = 0
let g:syntastic_error_symbol='✗'
let g:syntastic_warning_symbol='→'
let g:syntastic_ignore_files=['\c\.erb$']
let g:syntastic_stl_format='%E{💀 %fe (%e) ⮃}%W{ 💡 %fw (%w) }'
" nerdtree
let NERDTreeIgnore = ['\.tags$','^tags$']
" various mappings
noremap <leader>d :NERDTreeToggle<CR>
noremap <leader>g :TagbarOpenAutoClose<CR>
map <F4> :w<CR>
map <S-Insert> <MiddleMouse>
map! <S-Insert> <MiddleMouse>
" always show gutters
let g:gitgutter_sign_column_always = 1
let g:gitgutter_eager = 0
let g:gitgutter_realtime = 0
" comment header line
function! CommentHeader()
let times = 82 - col(".")
let line = getline(".")
" let space = matchstr(line, "(^#|^\s+#)") == "#" ? " " : ""
let space = " "
exe ":normal A" . space . repeat("-", times)
endfunction
" my macros
" -------------------------------------------------------------------------------
nnoremap <leader>jd i Josh Deere (josh@project93.com)
nnoremap <leader>- :call CommentHeader()<CR>o
" nnoremap <leader>- A <ESC>79i-<ESC>
" nnoremap <leader>= A <ESC>45i-<ESC>
" indent guides
let g:indent_guides_guide_size = 1
" XML folding
let g:xml_syntax_folder=1
au FileType xml setlocal foldmethod=syntax
" startify
" let g:startify_session_dir = '~/.vim/sessions'
let g:startify_files_number = 15
let g:startify_bookmarks = [ '~/Dropbox/scratch/ruby.rb', '~/Dropbox/TODO.otl', '~/.vim/vimrc', '~/.vim/gvimrc' ]
let g:startify_custom_header = [
\ ' ___',
\ ' ___ ___ /__/\',
\ ' /__/\ / /\ | |::\',
\ ' \ \:\ / /:/ | |:|:\',
\ ' \ \:\ /__/::\ __|__|:|\:\',
\ ' ___ \__\:\ \__\/\:\__ /__/::::| \:\',
\ ' /__/\ | |:| \ \:\/\ \ \:\~~\__\/',
\ ' \ \:\| |:| \__\::/ \ \:\',
\ ' \ \:\__|:| /__/:/ \ \:\',
\ ' \__\::::/ \__\/ \ \:\',
\ ' ~~~~ \__\/',
\ '',
\ ]
" let g:startify_custom_header = [
" \ ' _| _| _|_|_| _| _| ',
" \ '_|_|_|_|_| _| _| _| _|_| _|_| _|_|_|_|_| ',
" \ ' _| _| _| _| _| _| ',
" \ '_|_|_|_|_| _| _| _| _| _| _|_|_|_|_| ',
" \ ' _| _|_|_| _| _| ',
" \ '',
" \ ]
hi StartifyHeader ctermfg=203 guifg=#c4a3e1
hi StartifySlash ctermfg=240 guifg=#969696
hi StartifyPath ctermfg=203 guifg=#757575
" plugin configs
let g:tagbar_usearrows = 1
let g:tagbar_autofocus = 1
"tagma buf
let g:TagmaBufMgrLocation = 'R'
let g:TagmaBufMgrWidth = 20
"ctrlp stuff
let g:ctrlp_dont_split = 'nerdtree'
" nerdtree stuff
let NERDTreeShowBookmarks=1
let NERDTreeChDirMode=2
let NERDTreeMinimalUI=1
" textmate style mappings
" bind control-l to hashrocket
imap <C-l> <Space>=><Space>"
" bind command-" to shift right
nmap <D-]> >>
vmap <D-]> >>
imap <D-]> <C-O>>>
"
" " bind command-[ to shift left
nmap <D-[> <<
vmap <D-[> <<
imap <D-[> <C-O><<
" bind ctrlp to ;
" nmap ; :CtrlP<CR>
nmap <leader>F :CtrlPClearAllCaches<CR>
nnoremap <C-]> :CtrlPtjump<cr>
nmap , :Ag<space>
" make Esc happen without waiting for timeoutlen
" " fixes Powerline delay
augroup FastEscape
autocmd!
au InsertEnter * set timeoutlen=0
au InsertLeave * set timeoutlen=1000
augroup END
" speedy terminal
" -----------------------------------
set ttyfast
set notimeout
set ttimeout
set ttimeoutlen=100
syntax sync minlines=256
set synmaxcol=500
" javascript hax
" ------------------------------------------------------------------------
let g:javascript_conceal = 0
" Make ruby lambdas look cool
" ------------------------------------------------------------------------
" syntax keyword Statement lambda conceal cchar=λ
" hi! link Conceal Statement
set conceallevel=2
" vimshell configs
" ------------------------------------------------------------------------
nmap <leader>S :VimShell<CR>
nmap <leader>cS :VimShellCreate<CR>
let g:vimshell_prompt_expr = 'fnamemodify(getcwd(), ":~")." ❯❯ "'
let g:vimshell_prompt_pattern = '^\f\+ ❯❯ '
autocmd FileType vimshell setlocal wrap
autocmd FileType int-bundle setlocal wrap
" fugitive
" ------------------------------------------------------------------------
nmap <leader>G :Gcommit -a<CR>
" normal signs
" let g:gitgutter_sign_added = '+'
" let g:gitgutter_sign_modified = '-'
" let g:gitgutter_sign_modified_removed = '--'
" let g:gitgutter_sign_removed = '_ '
" thick marks
" let g:gitgutter_sign_added = '▐'
" let g:gitgutter_sign_modified = '▐'
" let g:gitgutter_sign_modified_removed = '▐'
" let g:gitgutter_sign_removed = '▐'
" thin marks │╏
let g:gitgutter_sign_added = '│'
let g:gitgutter_sign_modified = '│'
let g:gitgutter_sign_modified_removed = '│'
let g:gitgutter_sign_removed = '│'
" lightline
" ------------------------------------------------------------------------
source ~/.vim/dphase_lightline.vim
" Unite
" ------------------------------------------------------------------------
" Settings
" -----------------------------------
call unite#filters#matcher_default#use(['matcher_fuzzy'])
call unite#filters#sorter_default#use(['sorter_rank'])
call unite#custom#source('file_rec,file_rec/async,file_mru,file,buffer,grep',
\ 'ignore_pattern', join([
\ '\.git/',
\ '\.bundle/',
\ '\.yardoc/',
\ 'nodejs/*/node_modules/',
\ 'nodejs/',
\ 'git5/.*/review/',
\ 'google/obj/',
\ 'tmp/',
\ 'deprecated/',
\ 'nodejs/node_modules/',
\ 'assets/components/',
\ '.sass-cache',
\ ], '\|'))
let g:unite_source_history_yank_enable = 1
" Mappings
" -----------------------------------
function! s:unite_settings()
nmap <buffer> <ESC> <plug>(unite_exit)
imap <buffer> <ESC> <plug>(unite_exit)
nmap <buffer> <C-r> <Plug>(unite_redraw)
imap <buffer> <C-r> <Plug>(unite_redraw)
endfunction
autocmd FileType unite call s:unite_settings()
" let g:unite_split_rule = 'bottomleft'
nmap <leader>bl :<C-u>Unite -no-split -start-insert -buffer-name=buffer buffer<CR>
nmap <leader>y :<C-u>Unite -direction=botright -prompt-direction=top -winheight=10 -buffer-name=yank history/yank<CR>
nmap <leader>h :Unite -start-insert -winheight=10 -buffer-name=help help<CR>
nmap ; :<C-u>Unite -direction=botright -prompt-direction=top -winheight=10 -start-insert -buffer-name=files file_rec/async<CR>
" ------------------------------------------------------------------------
" vim-emmet
nmap <leader>e <C-Y>,a
" insert erb tab
inoremap <c-e> <% %><ESC>2hi
" Fast saving
nnoremap <leader>w :w<CR>
inoremap <c-w> <esc>:w<CR>i
" vnoremap <leader>w <esc>:w<CR>
" URL opener
nmap <leader>l :Utl<CR>
" better text folding
set fillchars=fold:\∙
function! NeatFoldText()
let line = ' ' . substitute(getline(v:foldstart), '^\s*\("\|#\|//\|/\)\?\s*\|\s*\("\|#\)\?\s*{{' . '{\d*\s*', '', 'g') . ' '
let lines_count = v:foldend - v:foldstart + 1
let lines_count_text = '│ ' . printf("%10s", lines_count . ' lines') . ' │'
let foldchar = matchstr(&fillchars, 'fold:\zs.')
let foldtextstart = strpart('∙' . repeat(foldchar, v:foldlevel*2) . line, 0, (winwidth(0)*2)/3)
let foldtextend = lines_count_text . repeat(foldchar, 8)
let foldtextlength = strlen(substitute(foldtextstart . foldtextend, '.', 'x', 'g')) + &foldcolumn
return foldtextstart . repeat(foldchar, winwidth(0)-foldtextlength) . foldtextend
endfunction
set foldtext=NeatFoldText()
" easyalign
" ------------------------------------------------------------------------
vnoremap <silent> <Enter> :EasyAlign<Enter>
" YouCompleteMe + UltiSnips
" ------------------------------------------------------------------------
let g:ycm_confirm_extra_conf = 0
let g:ycm_enable_diagnostic_signs = 0
let g:ycm_collect_identifiers_from_tags_files = 1
let g:ycm_add_preview_to_completeopt = 1
function! g:UltiSnips_Complete()
call UltiSnips_ExpandSnippet()
if g:ulti_expand_res == 0
if pumvisible()
return "\<C-n>"
else
call UltiSnips_JumpForwards()
if g:ulti_jump_forwards_res == 0
return "\<TAB>"
endif
endif
endif
return ""
endfunction
au BufEnter * exec "inoremap <silent> " . g:UltiSnipsExpandTrigger . " <C-R>=g:UltiSnips_Complete()<cr>"
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
" TagBar
" ------------------------------------------------------------------------
let g:tagbar_compact = 1
let g:tagbar_indent = 2
let g:tagbar_iconchars = ['▸', '▾']
let g:tagbar_type_ruby = {
\ 'kinds' : [
\ 'm:modules',
\ 'c:classes',
\ 'd:describes',
\ 'C:contexts',
\ 'f:methods',
\ 'b:filters',
\ 'p:routes',
\ 'F:singleton methods'
\ ]
\ }
" BroLink
" -------------------------------------------------------------------------------
let g:bl_no_mappings = 1
noremap <leader>bs :BLStart<CR>
noremap <leader>br :BLReloadPage<CR>
noremap <leader>bc :BLReloadCSS<CR>
" Origami
" -------------------------------------------------------------------------------
let g:OrigamiFoldAtCol = 77
" CoffeeScript
" ---------------------------------------------------------------------------------
hi link coffeeSpaceError NONE
hi link coffeeSemicolonError NONE
" Vim SLIME
" ------------------------------------------------------------------------
let g:slime_target = "tmux"
" Unite Workflow
" ---------------------------------------------------------------------------------
" Gist-VIM
let g:gist_detect_filetype = 1
let g:gist_open_browser_after_post = 1
let g:gist_show_privates = 1
let g:gist_post_privates = 1
" Remove trailing whitespace on save
" ---------------------------------------------------------------------------------
autocmd FileType c,ruby,coffee,css,slim,scss,html,xml autocmd BufWritePre <buffer> :%s/\s\+$//e
" Ruby scratch buffer
" ---------------------------------------------------------------------------------
" function! s:Scratch
" exe 'below split +buffer'
" endfunction