-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc.bundles
368 lines (319 loc) · 11.5 KB
/
vimrc.bundles
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
" vim: foldmethod=marker ts=2 sts=2 sw=2 fdl=0
" function {{{
let s:cache_dir = '~/.vimcache'
function! s:get_cache_dir(suffix)
return resolve(expand(s:cache_dir . '/' . a:suffix))
endfunction
"}}}
call plug#begin('~/.vim/plugged')
" ----------------------------------------------------------------------------
" <Enter> | vim-easy-align {{{
" ----------------------------------------------------------------------------
Plug 'junegunn/vim-easy-align', { 'on': ['<Plug>(EasyAlign)', 'EasyAlign'] }
let g:easy_align_delimiters = {
\ '>': { 'pattern': '>>\|=>\|>' },
\ '\': { 'pattern': '\\' },
\ '/': { 'pattern': '//\+\|/\*\|\*/', 'delimiter_align': 'l', 'ignore_groups': ['!Comment'] },
\ ']': {
\ 'pattern': '\]\zs',
\ 'left_margin': 0,
\ 'right_margin': 1,
\ 'stick_to_left': 0
\ },
\ ')': {
\ 'pattern': ')\zs',
\ 'left_margin': 0,
\ 'right_margin': 1,
\ 'stick_to_left': 0
\ },
\ 'f': {
\ 'pattern': ' \(\S\+(\)\@=',
\ 'left_margin': 0,
\ 'right_margin': 0
\ },
\ 'd': {
\ 'pattern': ' \ze\S\+\s*[;=]',
\ 'left_margin': 0,
\ 'right_margin': 0
\ }
\ }
" Start interactive EasyAlign in visual mode
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign with a Vim movement
nmap ga <Plug>(EasyAlign)
nmap gaa ga_
" xmap <Leader><Enter> <Plug>(LiveEasyAlign)
" nmap <Leader><Leader>a <Plug>(LiveEasyAlign)
" inoremap <silent> => =><Esc>mzvip:EasyAlign/=>/<CR>`z$a<Space>
" }}}
" ----------------------------------------------------------------------------
" goyo.vim + limelight.vim {{{
" ----------------------------------------------------------------------------
Plug 'junegunn/goyo.vim'
Plug 'junegunn/limelight.vim'
let g:limelight_paragraph_span = 1
let g:limelight_priority = -1
function! s:goyo_enter()
if has('gui_running')
set fullscreen
" set background=light
set linespace=7
elseif exists('$TMUX')
silent !tmux set status off
endif
" hi NonText ctermfg=101
Limelight
endfunction
function! s:goyo_leave()
if has('gui_running')
set nofullscreen
set background=dark
set linespace=0
elseif exists('$TMUX')
silent !tmux set status on
endif
Limelight!
endfunction
autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave()
nnoremap <Leader>G :Goyo<CR>
" }}}
" ============================================================================
" FZF {{{
" ============================================================================
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
if has('nvim')
let $FZF_DEFAULT_OPTS .= ' --inline-info'
" let $NVIM_TUI_ENABLE_TRUE_COLOR = 1
endif
" File preview using CodeRay (http://coderay.rubychan.de/)
let g:fzf_files_options =
\ '--preview "coderay {} 2> /dev/null | head -'.&lines.'"'
nnoremap <silent> <expr> <Leader><Enter> (expand('%') =~ 'NERD_tree' ? "\<c-w>\<c-w>" : '').":Files\<cr>"
nnoremap <silent> <Leader><Leader> :Buffers<CR>
nnoremap <silent> <Leader>C :Colors<CR>
nnoremap <silent> <Leader>ag :Ag <C-R><C-W><CR>
nnoremap <silent> <Leader>AG :Ag <C-R><C-A><CR>
nnoremap <silent> <Leader>` :Marks<CR>
nnoremap <silent> <Leader>n :bn<CR>
nnoremap <silent> <Leader>p :b#<CR>
inoremap <expr> <c-x><c-t> fzf#complete('tmuxwords.rb --all-but-current --scroll 500 --min 5')
imap <c-x><c-k> <plug>(fzf-complete-word)
imap <c-x><c-f> <plug>(fzf-complete-path)
imap <c-x><c-j> <plug>(fzf-complete-file-ag)
imap <c-x><c-l> <plug>(fzf-complete-line)
nmap <leader><tab> <plug>(fzf-maps-n)
xmap <leader><tab> <plug>(fzf-maps-x)
omap <leader><tab> <plug>(fzf-maps-o)
command! Plugs call fzf#run({
\ 'source': map(sort(keys(g:plugs)), 'g:plug_home."/".v:val'),
\ 'options': '--delimiter / --nth -1',
\ 'down': '~40%',
\ 'sink': 'Explore'})
" }}}
" ----------------------------------------------------------------------------
" Navigation/Searching {{{
" ----------------------------------------------------------------------------
Plug 'rking/ag.vim', { 'on': 'Ag' } "{{{
let g:ag_working_path_mode="r"
"}}}
Plug 'scrooloose/nerdtree', {'on': 'NERDTreeToggle'} "{{{
let NERDTreeShowHidden=1
let NERDTreeQuitOnOpen=0
let NERDTreeShowLineNumbers=0
let NERDTreeChDirMode=0
let NERDTreeShowBookmarks=0
let NERDTreeHijackNetrw=1
let NERDTreeMapJumpNextSibling="]"
let NERDTreeMapJumpPrevSibling="["
let NERDTreeIgnore=['\.git', '\.hg', '\.svn$', '\~$', '\.pyc$', '\.beam$', '\.gz$', 'cscope\.*', '\.[ao]$', '\.so$']
let NERDTreeBookmarksFile=s:get_cache_dir('NERDTreeBookmarks')
nnoremap <leader>t :NERDTreeToggle<CR>
"}}}
Plug 'easymotion/vim-easymotion' "{{{
let g:EasyMotion_do_mapping = 0 " Disable default mappings
map <leader> <Plug>(easymotion-prefix)
" Bi-directional find motion
" Jump to anywhere you want with minimal keystrokes, with just one key binding.
" `s{char}{char}{label}`
" Need one more keystroke, but on average, it may be more comfortable.
nmap s <Plug>(easymotion-s2)
nmap t <Plug>(easymotion-t2)
"" Turn on case insensitive feature
let g:EasyMotion_smartcase = 1
" JK motions: Line motions
map <leader>j <Plug>(easymotion-j)
map <leader>k <Plug>(easymotion-k)
"}}}"
" clear search highlight
map <leader>sc :nohl<CR>
"}}}
" ----------------------------------------------------------------------------
" UI {{{
" ----------------------------------------------------------------------------
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes' "{{{
let g:airline_theme = "bubblegum"
let g:airline_powerline_fonts = 1
let g:airline#extensions#tmuxline#enabled = 0
let g:airline#extensions#whitespace#enabled = 1
let g:airline#extensions#tagbar#enabled = 1
function! AirlineInit()
let g:airline_section_b = airline#section#create(['branch'])
let g:airline_section_c = '%<%t%m'
let g:airline_section_warning = airline#section#create(['syntastic'])
endfunction
autocmd VimEnter * if exists(':AirlineToggle') | call AirlineInit()
"}}}
" colors
Plug 'junegunn/seoul256.vim'
Plug 'tomasr/molokai'
Plug 'chriskempson/vim-tomorrow-theme'
" install in tmux, then there will be $TMUX
if exists('$TMUX')
Plug 'christoomey/vim-tmux-navigator'
Plug 'benmills/vimux' "{{{
" Run the current file with rspec
"map <leader>vb :call VimuxRunCommand("clear; rspec " . bufname("%"))<CR>
" Prompt for a command to run
map <leader>vp :VimuxPromptCommand<CR>
" Run last command executed by VimuxRunCommand
map <leader>vl :VimuxRunLastCommand<CR>
" Inspect runner pane
map <leader>vi :VimuxInspectRunner<CR>
" Close vim tmux runner opened by VimuxRunCommand
map <leader>vq :VimuxCloseRunner<CR>
" Interrupt any command running in the runner pane
map <leader>vx :VimuxInterruptRunner<CR>
" Zoom the runner pane (use <bind-key> z to restore runner pane)
map <leader>vz :call VimuxZoomRunner()<CR>
"}}}"
Plug 'edkolev/tmuxline.vim'
let g:tmuxline_preset = 'powerline'
let g:tmuxline_theme = 'powerline'
endif
Plug 'vim-scripts/ShowTrailingWhitespace'
Plug 'mhinz/vim-startify' "{{{
let g:startify_session_dir = s:get_cache_dir('sessions')
let g:startify_change_to_vcs_root = 1
let g:startify_show_sessions = 1
nnoremap <F1> :Startify<cr>
"}}}
Plug 'ryanoasis/vim-devicons' "{{{
let g:webdevicons_enable_nerdtree = 1
let g:webdevicons_enable_ctrlp = 1
let g:WebDevIconsNerdTreeAfterGlyphPadding = ' '
let g:DevIconsEnableFoldersOpenClose = 1
let g:WebDevIconsOS = 'Darwin'
"}}}
"}}}
" ----------------------------------------------------------------------------
" SCM {{{
" ----------------------------------------------------------------------------
Plug 'mhinz/vim-signify'
let g:signify_disable_by_default=1
let g:signify_update_on_bufenter=0
Plug 'tpope/vim-fugitive'
nnoremap <silent> <leader>gs :Gstatus<CR>
nnoremap <silent> <leader>gd :Gdiff<CR>
nnoremap <silent> <leader>gc :Gcommit<CR>
nnoremap <silent> <leader>gb :Gblame<CR>
nnoremap <silent> <leader>gl :Glog<CR>
nnoremap <silent> <leader>gp :Git push<CR>
nnoremap <silent> <leader>gw :Gwrite<CR>
nnoremap <silent> <leader>gr :Gremove<CR>
autocmd BufReadPost fugitive://* set bufhidden=delete
"}}}
" ----------------------------------------------------------------------------
" Editing {{{
" ----------------------------------------------------------------------------
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-unimpaired'
Plug 'scrooloose/nerdcommenter'
Plug 'terryma/vim-expand-region'
Plug 'terryma/vim-multiple-cursors'
Plug 'jiangmiao/auto-pairs' "{{{
let g:AutoPairsFlyMode = 0
"}}}
Plug 'mbbill/undotree', { 'on': 'UndotreeToggle' }
let g:undotree_SplitLocation='botright'
let g:undotree_SetFocusWhenToggle=1
let g:undotree_WindowLayout = 2
nnoremap U :UndotreeToggle<CR>
Plug 'vim-scripts/bufkill.vim'
nnoremap <leader>d :BD<cr>
"}}}
" ----------------------------------------------------------------------------
" Completion {{{
" ----------------------------------------------------------------------------
Plug 'honza/vim-snippets'
Plug 'Valloric/YouCompleteMe'
let g:ycm_complete_in_comments_and_strings=1
let g:ycm_key_list_select_completion=['<C-n>', '<Down>']
let g:ycm_key_list_previous_completion=['<C-p>', '<Up>']
let g:ycm_filetype_blacklist={'unite': 1}
" occur something wrong
"Plug 'SirVer/ultisnips'
" let g:UltiSnipsExpandTrigger="<tab>"
" let g:UltiSnipsJumpForwardTrigger="<tab>"
" let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
" let g:UltiSnipsSnippetsDir='~/.vim/snippets'
"}}}
" ----------------------------------------------------------------------------
" javascript {{{
" ----------------------------------------------------------------------------
Plug 'pangloss/vim-javascript', { 'for': 'javascript' }
Plug 'maksimr/vim-jsbeautify', { 'for': 'javascript' }
nnoremap <leader>fjs :call JsBeautify()<cr>
" Plug 'kchmck/vim-coffee-script', { 'for': 'coffee' }
Plug 'elzr/vim-json', { 'for': 'json' }
" }}}
" ----------------------------------------------------------------------------
" syntastic {{{
" ----------------------------------------------------------------------------
Plug 'scrooloose/syntastic'
let g:syntastic_error_symbol='>>'
let g:syntastic_warning_symbol='>'
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_loc_list_height = 5
let g:syntastic_javascript_checkers = ['jshint', 'eslint']
highlight SyntasticErrorSign guifg=white guibg=black
function! ToggleErrors()
let old_last_winnr = winnr('$')
lclose
if old_last_winnr == winnr('$')
Errors
endif
endfunction
nnoremap <Leader>s :call ToggleErrors()<cr>
" }}}
" ----------------------------------------------------------------------------
" markdown {{{
" ----------------------------------------------------------------------------
Plug 'tpope/vim-markdown', { 'for': 'markdown' }
Plug 'itspriddle/vim-marked', { 'for': 'markdown' }
" }}}
" ----------------------------------------------------------------------------
" Erlang/Elixir {{{
" ----------------------------------------------------------------------------
Plug 'jimenezrick/vimerl', { 'for': ['erlang', 'elixir'] }
let g:erlang_highlight_bif = 1
let erlang_show_errors = 0
Plug 'elixir-lang/vim-elixir', { 'for': 'elixir' }
if has('nvim')
Plug 'thinca/vim-ref'
Plug 'awetzel/elixir.nvim', {
\ 'for': 'elixir',
\ 'do': 'yes \| ./install.sh'
\}
let g:elixir_maxmenu = 30
let g:elixir_docpreview = 0
let g:elixir_showerror = 0
let g:elixir_autobuild = 0
endif
" }}}
call plug#end()