-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
404 lines (312 loc) · 12.1 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
" quick leader
let mapleader = ","
nnoremap ; :
vnoremap ; :
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vundle goodness
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" Let Vundle manage Vundle
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-surround'
" UI
Plugin 'chriskempson/tomorrow-theme', {'rtp': 'vim/'}
" Nav
Plugin 'scrooloose/nerdtree'
Plugin 'xolox/vim-misc'
Plugin 'tpope/vim-unimpaired'
" Ruby
Plugin 'thoughtbot/vim-rspec'
" Language Support
Plugin 'sheerun/vim-polyglot'
" Markdown
" Support *.md so that ftplugin/markdown.vim is autoloaded
Plugin 'tpope/vim-markdown'
Plugin 'chrisbra/csv.vim'
Plugin 'vim-scripts/LargeFile'
:imap jj <Esc>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Casing, spelling, etc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
:command Title :s/\<\(\w\)/\U\1/g
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Docker!
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Plugin 'ekalinin/Dockerfile.vim'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" bling/vim-airline
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
let g:airline_theme='tomorrow'
let g:airline_powerline_fonts = 1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Git & Github
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-rhubarb'
map <Leader>gs :Git<CR>
map <Leader>gc :Git commit<CR>
map <Leader>go :GBrowse<CR>
Plugin 'mattn/webapi-vim'
Plugin 'mattn/gist-vim'
Plugin 'mhinz/vim-signify'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" epmatsw/ag.vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Plugin 'rking/ag.vim'
nnoremap \ :Ag<SPACE>
if executable('ag')
" Use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command =
\ 'ag %s --files-with-matches -g "" --ignore "\.git$\|\.hg$\|\.svn$"'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" mattn/emmet-vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Plugin 'mattn/emmet-vim'
" Only use emmet with html/css
imap <C-k> <c-y>,
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" benmills/vimux
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Plugin 'benmills/vimux'
let g:VimuxUseNearestPane = 1
" Setup filetype specific <leader>a commands in ftplugin
nnoremap vlc :call VimuxRunLastCommand()<CR>
nmap vmp :VimuxPromptCommand<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" janko-m/vim-test
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Plugin 'janko-m/vim-test'
let test#strategy = "vimux"
nmap <silent> <leader>t :TestNearest<CR>
nmap <silent> <leader>T :TestFile<CR>
nmap <silent> <leader>a :TestSuite<CR>
nmap <silent> <leader>l :TestLast<CR>
nmap <silent> <leader>g :TestVisit<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" christoomey/vim-tmux-navigator
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Plugin 'christoomey/vim-tmux-navigator'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" kien/ctrlp.vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Plugin 'kien/ctrlp.vim'
let g:ctrlp_show_hidden = 1
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git'
let g:ctrlp_use_caching = 0 " Disable caching since Ag is blazin'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" dense-analysis/ale
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Plugin 'dense-analysis/ale'
set signcolumn=yes
let g:ale_fix_on_save = 1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Valloric/YouCompleteMe
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Plugin 'Valloric/YouCompleteMe'
let g:ycm_complete_in_comments = 1
let g:ycm_seed_identifiers_with_syntax = 1
" Disable auto showing documentation
let g:ycm_auto_hover=''
" Close the scratch pane created when cycling autocompletions
let g:ycm_autoclose_preview_window_after_completion = 1
nnoremap <leader>gd :YcmCompleter GoToDefinition<CR>
nnoremap <leader>gr :YcmCompleter GoToReferences<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" mattn/gist-vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:gist_clip_command = 'pbcopy'
let g:gist_detect_filetype = 1
let g:gist_open_browser_after_post = 1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Mappings
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Disable the ever-annoying Ex mode shortcut key. Type visual my ass. Instead,
" make Q repeat the last macro instead. *hat tip* http://vimbits.com/bits/263
nnoremap Q @@
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Text, tabs and indentation
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set tabstop=2 shiftwidth=2 " tabs rendered as 2 spaces
set expandtab " expand tabs to spaces (should this be filemode dependent?
set ai "Auto indent
"set si "Smart indent
set nobackup
set nowritebackup
set noswapfile
set nowrap
" make searches case-sensitive only if they contain upper-case characters
set ignorecase smartcase
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Buffers & Windows
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nmap <silent> <C-B> :bn<CR> " next buffer
nmap <silent> <C-N> :NERDTreeToggle<CR> " show/hide nerdtree
map <leader>q <esc>:copen<CR> " Open quick fix
" window
nmap <leader>gwh :topleft vnew<CR>
nmap <leader>gwl :botright vnew<CR>
nmap <leader>gwk :topleft new<CR>
nmap <leader>gwj :botright new<CR>
" " buffer
nmap <leader>gh :leftabove vnew<CR>
nmap <leader>gl :rightbelow vnew<CR>
nmap <leader>gk :leftabove new<CR>
nmap <leader>gj :rightbelow new<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" No 'Press Any Key to Contiue BS'
" from: http://vim.wikia.com/wiki/Avoiding_the_%22Hit_ENTER_to_continue%22_prompts
command! -nargs=1 SilentCmd
\ | execute ':silent !'.<q-args>
\ | execute ':redraw!'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Refluxoring
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Make this perty
vmap <leader>k <esc>:'<,'>=G<CR>
" Make it all perty
map <leader>k gg=G''<CR>
" Search and Replace word under cursor
:nnoremap <Leader><Leader>s /<C-r><C-w>
:nnoremap <Leader>r :%s/\<<C-r><C-w>\>//g<Left><Left>
" Grep (Ag) word under cursor
:nnoremap <Leader><Leader>S :Ag <C-r><C-w>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Learnin'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
map <leader>? <esc>:Dash<CR> " Dash to the rescue
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Happy viming
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
:command! W w
:command! Q q
:command! Wq wq
:command! WQ q
:command! E ene
" Auto reload vimrc
augroup reload_vimrc " {
autocmd!
autocmd BufWritePost $MYVIMRC source $MYVIMRC
augroup END " }
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Write Buffer if Necessary
"
" Writes the current buffer if it's needed, unless we're the in QuickFix mode.
" Source: https://github.com/mutewinter/dot_vim/
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! WriteBufferIfNecessary()
if &modified && filewritable(expand('%')) && !&readonly
:write
endif
endfunction
command! WriteBufferIfNecessary call WriteBufferIfNecessary()
function! CRWriteIfNecessary()
if &filetype == "qf"
" Execute a normal enter when in Quickfix list.
execute "normal! \<enter>"
else
WriteBufferIfNecessary
:redraw!
endif
endfunction
" Clear the search buffer when hitting return
" Idea for MapCR from http://git.io/pt8kjA
function! MapCR()
nnoremap <silent> <enter> :call CRWriteIfNecessary()<CR>
endfunction
call MapCR()
" Show hex colors in their actual color"
Plugin 'chrisbra/Colorizer'
let g:colorizer_auto_color = 1
let g:colorizer_auto_filetype='css,html,js,sh'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ApiBlueprint support
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Plugin 'kylef/apiblueprint.vim'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" tpope/vim-rails
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Plugin 'tpope/vim-rails'
nnoremap <LEADER>av :AV<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Run buffers quickly
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Plugin 'thinca/vim-quickrun'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Happy rails
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Restart Pow.cx for the Current App
command! PowRestart :SilentCmd touch tmp/restart.txt; touch tmp/.livereload.rb
" Capistrano tasks are ruby files
au BufNewFile,BufRead *.cap set filetype=ruby
au BufNewFile,BufRead *.rabl set filetype=ruby
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Misc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
noremap % v% " Jump to matching object and visual select stuff between
command! NF :NERDTreeFind
nnoremap <leader>q :call QuickfixToggle()<cr>
let g:quickfix_is_open = 0
function! QuickfixToggle()
if g:quickfix_is_open
cclose
let g:quickfix_is_open = 0
else
copen
let g:quickfix_is_open = 1
endif
endfunction
nnoremap <leader><leader>o :call SystemOpenCurrentFile()<cr>
function! SystemOpenCurrentFile()
:SilentCmd open %
endfunction
set relativenumber " Relative line numbers
set number " makes current line show linear line number
set hlsearch " Highlight search matches
set laststatus=2
set clipboard=unnamed
map <leader><leader>O !open %<CR>
call vundle#end()
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" API Blueprint
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
au BufNewFile,BufRead *.apib set filetype=apiblueprint
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" UI
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set t_Co=256
set noshowmode " Airline gives mode
colorscheme Tomorrow
if exists('+colorcolumn')
set colorcolumn=80
endif
filetype plugin indent on
syntax enable
set exrc
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_symbols.linenr = " "
let g:airline_symbols.colnr = "℅ "
let g:airline_symbols.maxlinenr = ''
let g:airline_section_z = airline#section#create(['linenr', 'maxlinenr', ' ', 'colnr' ])
au BufRead,BufNewFile *.soql setfiletype soql
set completeopt=longest,menuone
let g:ycm_language_server =
\ [
\ {
\ 'name': 'soql',
\ 'cmdline': [ '/Users/rcromwell/projects/soql-language-server/server.sh' ],
\ 'filetypes': [ 'soql' ]
\ }
\ ]