forked from thoughtbot/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvimrc.bundles
344 lines (283 loc) · 12.3 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
" Auto Install Plug {{{
if empty(glob('~/.vim/autoload/plug.vim'))
silent !mkdir -p ~/.vim/autoload
silent !curl -fLo ~/.vim/autoload/plug.vim
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall
endif
" }}}
call plug#begin('~/.vim/bundle')
" Appearance {{{
" True Color
Plug 'sainnhe/everforest'
" display the indention levels with thin vertical lines
Plug 'Yggdroot/indentLine'
" let g:indentLine_fileType = ['ruby', 'eruby', 'elixir', 'eelixir', 'javascript']
" Plug 'ryanoasis/vim-devicons'
Plug 'itchyny/lightline.vim'
" }}}
" Tim Pope's Plugins {{{
" all about 'surroundings': parentheses, brackets, quotes, and more
Plug 'tpope/vim-surround'
" Pairs of handy bracket mappings, like ]n jumpt to SCM conflict
Plug 'tpope/vim-unimpaired'
" automatically adjusts 'shiftwidth' and 'expandtab' heuristically based on the current file
Plug 'tpope/vim-sleuth'
" enable repeating supported plugin maps with "."
Plug 'tpope/vim-repeat'
" easily search for, substitute, and abbreviate multiple variants of a word
" switch case using crc, crs, crm, etc.
Plug 'tpope/vim-abolish'
" sugar for the UNIX shell commands
" Plug 'tpope/vim-eunuch'
" }}}
" Junegunn Choi's Plugins {{{
" fzf is a general-purpose command-line fuzzy finder
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
" Starting fzf in a floating window
let g:fzf_layout = { 'window': { 'width': 0.8, 'height': 0.8 } }
Plug 'junegunn/fzf.vim'
" let g:fzf_preview_window = 'right:50%'
nnoremap <silent><C-p> :GitFiles<CR>
nnoremap <silent><leader>gl :GFiles?<CR>
nnoremap <silent><leader>fo :Files<CR>
nnoremap <silent><leader>fb :Buffers<CR>
nnoremap <silent><leader>fh :History<CR>
nnoremap <silent><leader>fg :Rg<CR>
nnoremap <silent><leader>fl :BLines<CR>
nnoremap <silent><leader>fm :Marks<CR>
" only filter the first column in Tags results
autocmd VimEnter *
\ command! -bang -nargs=* Tags call fzf#vim#tags(<q-args>, {'options': '-n1'}, <bang>0)
" matches tags starting with the word under cursor
" nnoremap <silent><Leader>oo :call fzf#vim#tags('^' . expand('<cword>'), {'options': '--exact --select-1 --exit-0 +i'})<CR>
" nnoremap <silent><Leader>oo :call fzf#vim#tags(expand('<cword>'), {'options': '--exact --select-1 --exit-0'})<CR>
" filter btags by f/m/v/p to be very usful!
" nnoremap <silent><Leader>ot :call fzf#vim#buffer_tags('', { 'options': ['--nth', '..-2,-1'] })<CR>
" nnoremap <silent><Leader>rg :Rg <C-R><C-W><CR>
" nnoremap <silent><Leader>ag :Ag <C-R><C-W><CR>
" make fzf completely delegate its search responsibliity to ripgrep process
" by making it restart ripgrep whenever the query string is updated.
function! RipgrepFzf(query, fullscreen)
let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case %s || true'
let initial_command = printf(command_fmt, shellescape(a:query))
let reload_command = printf(command_fmt, '{q}')
let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]}
call fzf#vim#grep(initial_command, 1, { 'options': '--color hl:123,hl+:222' }, a:fullscreen)
endfunction
command! -nargs=* -bang Rg call RipgrepFzf(<q-args>, <bang>0)
" PRO tips: https://github.com/junegunn/fzf.vim/issues/347
" function! s:goto_def(lines) abort
" silent! exe 'e +BTags '.a:lines[0]
" call timer_start(10, {-> execute('startinsert') })
" endfunction
"
" function! s:goto_line(lines) abort
" silent! exe 'e '.a:lines[0]
" call timer_start(10, {-> feedkeys(':') })
" endfunction
function! s:build_quickfix_list(lines)
call setqflist(map(copy(a:lines), '{ "filename": v:val }'))
copen
cc
endfunction
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-h': 'split',
\ 'ctrl-i': 'vsplit',
\ 'ctrl-q': function('s:build_quickfix_list'),
\ }
" let g:fzf_action = {
" \ 'ctrl-t': 'tab split',
" \ 'ctrl-i': 'vsplit',
" \ 'ctrl-q': function('s:build_quickfix_list'),
" \ '@': function('s:goto_def'),
" \ ':': function('s:goto_line')
" \ }
" bridges the gap between tags and fzf.vim
" - If there are 0 or 1 definitions, the behavior is same as :tag.
" - When there are multiple definitions, the results are piped to fzf for interactive filtering (https://github.com/junegunn/fzf#search-syntax).
" Plug 'zackhsi/fzf-tags'
" nmap <C-]> <Plug>(fzf_tags)
" simple, easy-to-use Vim alignment plugin
" Plug 'junegunn/vim-easy-align'
" " Start interactive EasyAlign in visual mode (e.g. vip<Enter>)
" xmap <CR> <Plug>(EasyAlign)
" Find-N-Replace in Vim with live preview
Plug 'junegunn/vim-fnr'
" Peekaboo extends " and @ in normal mode and <CTRL-R> in insert mode so you can see the contents of the registers
" Plug 'junegunn/vim-peekaboo'
" Improved /-search for Vim
" this plugin has many issues that cannot be easily fixed. I suggest that you try simpler alternatives like vim-evanesco or vim-slash.
" Plug 'junegunn/vim-pseudocl'
" Plug 'junegunn/vim-oblique'
" automatically clearing Vim's search highlighting whenever the cursor moves or insert mode is entered
Plug 'junegunn/vim-slash'
" Plug 'junegunn/goyo.vim'
" Plug 'junegunn/limelight.vim'
" let g:limelight_paragraph_span = 1
" let g:limelight_priority = -1
" }}}
" Core {{{
" Vim 中文文档
Plug 'yianwillis/vimcdoc'
" Delete buffers and close files in Vim without closing your windows or messing up your layout
Plug 'moll/vim-bbye'
" A plugin that lets you highlight, navigate, and operate on sets of matching text. It extends vim's % key to language-specific words instead of just single characters.
Plug 'andymass/vim-matchup'
" An extensible & universal comment vim-plugin that also handles embedded filetypes
Plug 'tomtom/tcomment_vim'
" insert or delete brackets, parens, quotes in pair
Plug 'jiangmiao/auto-pairs'
" A powered code search and view tool, can edit in place
" Plug 'dyng/ctrlsf.vim'
" nnoremap <C-e> :CtrlSF<CR>
" New generation multiple cursors plugin for vim/neovim, higher speed and more features, see `:h visual-multi`
" select words with Ctrl-N (like Ctrl-d in Sublime Text/VS Code)
" create cursors vertically with Ctrl-Down/Ctrl-Up
" select one character at a time with Shift-Arrows
" press n/N to get next/previous occurrence
" press [/] to select next/previous cursor
" press q to skip current and get next occurrence
" press Q to remove current cursor/selection
Plug 'mg979/vim-visual-multi'
" whenever you are in the insert mode and paste into your terminal emulator using command+v, shift+insert, ctrl+shift+v or middle-click, vim will automatically :set paste for you.
Plug 'ConradIrwin/vim-bracketed-paste'
" Jump to any location specified by two characters. invoked with s followed by exactly two characters
Plug 'justinmk/vim-sneak'
let g:sneak#label = 1
" Plug 'Lokaltog/vim-easymotion'
" " easymotion prefix
" map , <Plug>(easymotion-prefix)
" " not case censitive
" let g:EasyMotion_smartcase = 1
" gof opens the file manager at the directory of the file you are currently editing in Vim.
" got opens the terminal at the directory of the file you are currently editing in Vim.
" Plug 'justinmk/vim-gtfo'
" Extended f, F, t and T key mappings
Plug 'rhysd/clever-f.vim'
" a plugin to place, toggle and display marks.
Plug 'kshenoy/vim-signature'
" Easy text exchange operator plugin: To exchange two words, place your cursor on the first word and type cxiw. Then move to the second word and type cxiw again.
" Plug 'tommcdo/vim-exchange'
" Range, pattern and substitute preview tool
Plug 'xtal8/traces.vim'
" shows keybindings in popup
Plug 'liuchengxu/vim-which-key'
nnoremap <silent> <leader> :<c-u>WhichKey '<Space>'<CR>
" Plug 'fszymanski/fzf-quickfix', {'on': 'Quickfix'}
" General purpose asynchronous tree viewer written in Pure Vim script
Plug 'lambdalisue/fern.vim'
let g:fern#disable_default_mappings = 1
" let g:fern#disable_drawer_smart_quit = 1
let g:fern#disable_viewer_hide_cursor = 1
" let g:fern#mark_symbol = '●'
" let g:fern#renderer#default#collapsed_symbol = '▷ '
" let g:fern#renderer#default#expanded_symbol = '▼ '
" let g:fern#renderer#default#leading = ' '
" let g:fern#renderer#default#leaf_symbol = ' '
" let g:fern#renderer#default#root_symbol = '~ '
noremap <silent> <C-u> :Fern . -drawer -reveal=% -width=35 -toggle<CR><C-w>=
function! FernInit() abort
nmap <buffer><expr>
\ <Plug>(fern-my-open-expand-collapse)
\ fern#smart#leaf(
\ "\<Plug>(fern-action-open:select)",
\ "\<Plug>(fern-action-expand)",
\ "\<Plug>(fern-action-collapse)",
\ )
" nmap <buffer> <2-LeftMouse> <Plug>(fern-my-open-expand-collapse)
nmap <buffer> o <Plug>(fern-my-open-expand-collapse)
nmap <buffer> m <Plug>(fern-action-mark:toggle)j
nmap <buffer> N <Plug>(fern-action-new-file)
nmap <buffer> K <Plug>(fern-action-new-dir)
nmap <buffer> D <Plug>(fern-action-remove)
nmap <buffer> V <Plug>(fern-action-move)
nmap <buffer> r <Plug>(fern-action-rename)
nmap <buffer> c <Plug>(fern-action-clipboard-copy)
nmap <buffer> p <Plug>(fern-action-clipboard-paste)
nmap <buffer> s <Plug>(fern-action-open:split)
nmap <buffer> i <Plug>(fern-action-open:vsplit)
nmap <buffer> y <Plug>(fern-action-yank)
nmap <buffer> R <Plug>(fern-action-reload)
nmap <buffer> <nowait> x <Plug>(fern-action-zoom)
nmap <buffer> <nowait> h <Plug>(fern-action-hidden:toggle)
nmap <buffer> <nowait> < <Plug>(fern-action-leave)
nmap <buffer> <nowait> > <Plug>(fern-action-enter)
endfunction
augroup FernEvents
autocmd!
autocmd FileType fern call FernInit()
augroup END
Plug 'lambdalisue/fern-git-status.vim'
let g:fern_git_status#disable_ignored = 1
let g:fern_git_status#disable_untracked = 1
let g:fern_git_status#disable_submodules = 1
" }}}
" Tmux {{{
" Seamless navigation between tmux panes and vim splits
" Plug 'christoomey/vim-tmux-navigator'
" A simple, vimscript only, command runner for sending commands from vim to tmux
" Plug 'christoomey/vim-tmux-runner'
" let g:VtrUseVtrMaps = 1
" let g:VtrStripLeadingWhitespace = 0
" let g:VtrClearEmptyLines = 0
" let g:VtrAppendNewline = 1
" }}}
" Programming {{{
" Switch between single-line and multiline forms of code: gS to split a one-liner into multiple lines. gJ (with the cursor on the first line of a block) to join a block into a single-line.
" Supporting ruby, elixir, python, go, html, css, and more. see help
Plug 'AndrewRadev/splitjoin.vim'
" switch segments of text with predefined replacements. default mapping `gs` to trigger the command.
Plug 'AndrewRadev/switch.vim', { 'for': ['ruby', 'elixir', 'coffee'] }
" search for terms using the excellent Dash.app
Plug 'rizzatti/dash.vim'
" }}}
" Text Objects {{{
Plug 'kana/vim-textobj-user' " Create your own text objects
Plug 'kana/vim-textobj-line' " al | il
Plug 'kana/vim-textobj-syntax' " ay | iy
Plug 'kana/vim-textobj-indent' " ai | ii
" Plug 'kana/vim-textobj-lastpat' " a/ | i/
" Plug 'nelstrom/vim-textobj-rubyblock' " ar | ir
" Plug 'osyo-manga/vim-textobj-multiblock' " ab | ib
" Plug 'idbrii/textobj-word-column.vim' " ac | ic
" Plug 'Julian/vim-textobj-variable-segment' " av | iv
" Plug 'bootleq/vim-textobj-rubysymbol' " a: | i:
" }}}
" Git {{{
" Show a diff using Vim its sign column
Plug 'mhinz/vim-signify'
let g:signify_vcs_list = ['git']
" GitHub extension for fugitive.vim
Plug 'tpope/vim-rhubarb'
" A git commit browser
Plug 'junegunn/gv.vim'
" Dark powered premier plugin for Git!!
Plug 'tpope/vim-fugitive'
nnoremap <Leader>gs :Git<CR>
augroup gitcommit
autocmd!
autocmd FileType gitcommit call s:add_commit_prefix_from_branch()
augroup END
function! s:add_commit_prefix_from_branch() abort
if expand('%') ==? '.git/COMMIT_EDITMSG' && empty(getline(1))
let head = fugitive#head()
if stridx(head, '/') > -1
call setline(1, '['.split(head, '/')[1].'] ')
startinsert!
endif
endif
endfunction
" }}}
" Misc {{{
" A collection of language packs
Plug 'sheerun/vim-polyglot'
" Plug 'kchmck/vim-coffee-script'
" Asynchronous translating plugin
Plug 'voldikss/vim-translator'
" Search word in macOS dictionary
" Plug 'skywind3000/vim-quickui'
" Plug 'xfyuan/vim-mac-dictionary'
" }}}
call plug#end()