-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvimrc.bundles
More file actions
342 lines (312 loc) · 11 KB
/
vimrc.bundles
File metadata and controls
342 lines (312 loc) · 11 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
if &compatible
set nocompatible
end
" Vundle to vim-plug migration shim
function! VundleToPlug(vundle_command, arg, ...)
echom "You are using Vundle's `".a:vundle_command."` command to declare plugins. Dotfiles now uses vim-plug for plugin management. Please rename uses of `".a:vundle_command."` to `Plug`. Plugin was '".a:arg."'."
let vim_plug_options = {}
if a:0 > 0
if has_key(a:1, 'name')
let name = a:1.name
let vim_plug_options.dir = "$HOME/.vim/bundle/".a:1.name
endif
if has_key(a:1, 'rtp')
let vim_plug_options.rtp = a:1.rtp
endif
endif
Plug a:arg, vim_plug_options
endfunction
com! -nargs=+ -bar Plugin call VundleToPlug("Plugin", <args>)
com! -nargs=+ -bar Bundle call VundleToPlug("Bundle", <args>)
call plug#begin()
" Tpope plugins
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
let g:surround_no_insert_mappings = 1
imap <C-d> <Plug>Isurround
imap <C-y> <Plug>ISurround
Plug 'tpope/vim-abolish'
" Case conversions: crm=MixedCase, crc=camelCase, crs=snake_case,
" cru=UPPER_CASE, cr-=dash-case, cr.=dot.case, cr<space>=space case, crt=Title Case
" Git
Plug 'mhinz/vim-signify'
let g:signify_vcs_list = ['git']
omap ic <plug>(signify-motion-inner-pending)
xmap ic <plug>(signify-motion-inner-visual)
omap ac <plug>(signify-motion-outer-pending)
xmap ac <plug>(signify-motion-outer-visual)
nmap ]h <plug>(signify-next-hunk)
nmap [h <plug>(signify-prev-hunk)
nmap ]H 9999]h
nmap [H 9999[h
Plug 'tpope/vim-fugitive'
nnoremap <Leader>gb :Git blame<CR>
Plug 'tpope/vim-rhubarb'
" Text objects
Plug 'kana/vim-textobj-user'
Plug 'fvictorio/vim-textobj-backticks' " a` | i`
Plug 'kana/vim-textobj-indent' " ai | ii
Plug 'sgur/vim-textobj-parameter' " a, | i,
Plug 'whatyouhide/vim-textobj-xmlattr' " ax | ix
Plug 'nelstrom/vim-textobj-rubyblock' " ar | ir
Plug 'bootleq/vim-textobj-rubysymbol' " a: | i:
Plug 'whatyouhide/vim-textobj-erb' " aE | iE
Plug 'thinca/vim-textobj-between' " af{char} | if{char}
Plug 'griffinqiu/vim-textobj-numeral' " an | in, ad | id
" Editing tools
Plug 'editorconfig/editorconfig-vim'
Plug 'christoomey/vim-sort-motion'
Plug 'AndrewRadev/splitjoin.vim'
Plug 'rizzatti/dash.vim'
nmap <silent> <leader>d <Plug>DashSearch
Plug 'liangfeng/vimcdoc'
" File browsing
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
nnoremap <silent> <leader>e :NERDTreeToggle<CR>
nnoremap <silent> <leader>nf :NERDTreeFind<CR>
let g:NERDTreeMapPreview = "p"
let g:NERDTreeMapOpenSplit = "s"
let g:NERDTreeMapOpenVSplit = "v"
let g:NERDTreeMapOpenInTab = "t"
let g:NERDTreeMapToggleHidden = "I"
let g:NERDTreeMapJumpRoot = "<c-p>"
let g:NERDTreeMapJumpParent = "P"
let g:NERDTreeMapJumpFirstChild = "^"
let g:NERDTreeIgnore=['\.meta$', '\.pyc$']
let g:NERDTreeMapOpenExpl="<nop>"
let NERDTreeChDirMode = 2
let NERDTreeShowBookmarks = 1
let NERDTreeWinSize = 30
Plug 'Xuyuanp/nerdtree-git-plugin'
let g:NERDTreeGitStatusIndicatorMapCustom = {
\ 'Modified' : '•',
\ 'Staged' : '✚',
\ 'Untracked' : 'ᵁ',
\ 'Renamed' : '≫',
\ 'Unmerged' : '≠',
\ 'Ignored' : 'ⁱ',
\ 'Deleted' : '✖',
\ 'Unknown' : '⁇'
\ }
Plug 'scrooloose/nerdcommenter'
let g:NERDSpaceDelims=1
" Search and replace
Plug 'lfv89/vim-interestingwords'
let g:interestingWordsDefaultMappings = 0
let g:interestingWordsGUIColors = ['#e67e80', '#dbbc7f', '#a7c080', '#7fbbb3', '#d699b6', '#83c092', '#e69875']
let g:interestingWordsTermColors = ['1', '2', '3', '4', '5', '6', '7']
Plug 'dyng/ctrlsf.vim'
nmap <C-G>g <Plug>CtrlSFPrompt
nmap <C-G>G <Plug>CtrlSFCwordPath
nmap <C-G><C-G> <Plug>CtrlSFCwordExec
vmap <C-G>g <Plug>CtrlSFVwordPath
vmap <C-G><C-G> <Plug>CtrlSFVwordExec
nmap <C-G>p <Plug>CtrlSFPwordPath
nmap <C-G><C-P> <Plug>CtrlSFPwordExec
nnoremap <C-G><C-O> :CtrlSFOpen<CR>
nmap <C-G>l <Plug>CtrlSFQuickfixPrompt
vmap <C-G>l <Plug>CtrlSFQuilkfixVwordPath
vmap <C-G>L <Plug>CtrSFQuickfixVwordPath
vmap <C-G><C-L> <Plug>CtrlSFQuickfixVwordExec
nmap <silent><leader>sf :CtrlSFToggle<CR>
nnoremap <leader>sr :CtrlSF <SPACE>
vnoremap <leader>sr y:CtrlSF <C-r>"<CR>
nnoremap \ :CtrlSF <SPACE>
let g:ctrlsf_mapping = {
\ "next": "<c-n>",
\ "prev": "<c-p>",
\ "split": "s",
\ "vsplit": "v",
\ "tab": "t",
\ "quit": "q",
\ }
let g:ctrlsf_auto_close = 0
let g:ctrlsf_auto_focus = {
\ "at": "start"
\ }
let g:ctrlsf_auto_preview = 0
let g:ctrlsf_case_sensitive = 'smart'
let g:ctrlsf_default_root = 'project'
let g:ctrlsf_default_view_mode = 'compact'
let g:ctrlsf_populate_qflist = 1
let g:ctrlsf_position = 'right'
let g:ctrlsf_winsize = '40%'
let g:ctrlsf_context = '-B 2 -A 2'
let g:ctrlsf_ignore_dir = ['node_modules', 'build', 'tmp', 'proto', '.git', 'dist']
let g:ctrlsf_search_mode = 'async'
Plug 'terryma/vim-multiple-cursors'
let g:multi_cursor_start_key='<c-n>'
let g:multi_cursor_start_word_key='g<c-n>'
let g:multi_cursor_quit_key = '<Esc>'
" Code navigation
Plug 'ludovicchabant/vim-gutentags'
let g:gutentags_project_root = ['.root', '.svn', '.git', '.project']
let g:gutentags_cache_dir='~/.cache/nvim/backups'
let g:gutentags_generate_on_write = 1
let g:gutentags_generate_on_missing = 0
let g:gutentags_generate_on_new = 0
let g:gutentags_ctags_exclude_wildignore = 1
" Fuzzy finder
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-s': 'split',
\ 'ctrl-v': 'vsplit' }
let $FZF_DEFAULT_OPTS = '--bind ctrl-s:select-all,ctrl-d:deselect-all'
let g:fzf_preview_window = ''
" Gruvbox color scheme
let g:fzf_colors = {
\ 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'border': ['fg', 'Ignore'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
nnoremap <c-p> :GitFiles<CR>
nnoremap <leader>ff :Files<CR>
nnoremap <leader>fg :Rg
nnoremap <leader>fb :Buffers<CR>
nnoremap <leader>fH :Helptags<CR>
nnoremap <leader>f/ :History/<CR>
nnoremap <leader>f: :History:<CR>
nnoremap <leader>ft :Tags<CR>
nnoremap <leader>fbt :BTags<CR>
nnoremap <leader>fc :Commits<CR>
nnoremap <leader>fB :BCommits<CR>
nnoremap <leader>fm :Marks<CR>
nnoremap <leader>fC :Commands<CR>
nmap <leader>fmn :call fzf#vim#maps('n', 0)<cr>
nmap <leader>fmi :call fzf#vim#maps('i', 0)<cr>
nmap <leader>fmx :call fzf#vim#maps('x', 0)<cr>
nmap <leader>fmv :call fzf#vim#maps('v', 0)<cr>
nmap <leader>fmo :call fzf#vim#maps('o', 0)<cr>
nnoremap <silent> <leader>at :let @"=&filetype \| Agt --<C-R>" <C-R><C-W><CR>
Plug 'zackhsi/fzf-tags'
nmap g<c-]> <Plug>(fzf_tags)
" Language: Rust, Go
Plug 'rust-lang/rust.vim'
Plug 'fatih/vim-go', { 'for': 'go', 'do': ':GoInstallBinaries' }
let g:go_fmt_fail_silently = 1
let g:go_highlight_trailing_whitespace_error = 0
let g:go_list_height = 10
let g:go_def_mapping_enabled = 0
let g:go_auto_sameids = 0
let g:go_code_completion_enabled = 0
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
autocmd FileType go nmap <leader>go <Plug>(go-imports)
autocmd FileType go nmap <leader>gg :<C-u>call <SID>build_go_files()<CR>
autocmd FileType go nmap <leader>gO :GoImport<SPACE>
autocmd FileType go nmap <leader>gd :GoDeclsDir<cr>
autocmd FileType go nmap <Leader>gh <Plug>(go-info)
autocmd FileType go nmap <leader>gC <Plug>(go-coverage-toggle)
autocmd Filetype go command! -bang A call go#alternate#Switch(<bang>0, 'edit')
autocmd Filetype go command! -bang AV call go#alternate#Switch(<bang>0, 'vsplit')
autocmd Filetype go command! -bang AS call go#alternate#Switch(<bang>0, 'split')
" Language: JavaScript, Vue
Plug 'mxw/vim-jsx', { 'for': 'javascript' }
Plug 'posva/vim-vue'
let g:vue_pre_processors = []
autocmd FileType vue MatchDebug
let g:ft = ''
fu! NERDCommenter_before()
if &ft == 'vue'
let g:ft = 'vue'
let stack = synstack(line('.'), col('.'))
if len(stack) > 0
let syn = synIDattr((stack)[0], 'name')
if len(syn) > 0
let syn = tolower(syn)
exe 'setf '.syn
endif
endif
endif
endfu
fu! NERDCommenter_after()
if g:ft == 'vue'
setf vue
g:ft
endif
endfu
" Language: Ruby, Rails
Plug 'Keithbsmiley/rspec.vim', { 'for': 'ruby' }
Plug 'ecomba/vim-ruby-refactoring', { 'for': 'ruby' }
Plug 'vim-ruby/vim-ruby', { 'for': 'ruby' }
Plug 'tpope/vim-rails', { 'for': ['ruby', 'eruby'] }
Plug 'tpope/vim-rbenv', { 'for': 'ruby' }
Plug 'tpope/vim-bundler', { 'for': 'ruby' }
Plug 'tpope/vim-pathogen', { 'for': 'ruby' }
Plug 'AndrewRadev/switch.vim'
let g:switch_mapping = "-"
" Theme
Plug 'morhetz/gruvbox'
Plug 'vim-airline/vim-airline'
let airline#extensions#gutentags#enabled = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_symbols.maxlinenr = ''
let g:airline_symbols.colnr = ':'
" AI assistance
Plug 'github/copilot.vim'
imap <silent><script><expr> <C-J> copilot#Accept("\<CR>")
let g:copilot_no_tab_map = v:true
let b:copilot_enabled = 1
call plug#end()
" vim-interestingwords keymaps (aligned with nvim)
" Note: Plugin has compatibility issues with Vim 9, waiting for fix
" See: https://github.com/lfv89/vim-interestingwords/issues/41
nnoremap <silent> <leader># <Plug>InterestingWords
vnoremap <silent> <leader># <Plug>InterestingWords
nnoremap <silent> <leader><esc> <Plug>InterestingWordsClear
" Utility functions
nnoremap \h :let Value=<C-R><C-W><CR>
nnoremap \p :if exists('Value')<Bar>normal i<C-R>=Value<CR><Esc><Bar>:endif<CR>
command! -nargs=? -range Dec2hex call s:Dec2hex(<line1>, <line2>, '<args>')
function! s:Dec2hex(line1, line2, arg) range
if empty(a:arg)
if histget(':', -1) =~# "^'<,'>" && visualmode() !=# 'V'
let cmd = 's/\%V\<\d\+\>/\=printf("0x%x",submatch(0)+0)/g'
else
let cmd = 's/\<\d\+\>/\=printf("0x%x",submatch(0)+0)/g'
endif
try
execute a:line1 . ',' . a:line2 . cmd
catch
echo 'Error: No decimal number found'
endtry
else
echo printf('%x', a:arg + 0)
endif
endfunction
command! -nargs=? -range Hex2dec call s:Hex2dec(<line1>, <line2>, '<args>')
function! s:Hex2dec(line1, line2, arg) range
if empty(a:arg)
if histget(':', -1) =~# "^'<,'>" && visualmode() !=# 'V'
let cmd = 's/\%V0x\x\+/\=submatch(0)+0/g'
else
let cmd = 's/0x\x\+/\=submatch(0)+0/g'
endif
try
execute a:line1 . ',' . a:line2 . cmd
catch
echo 'Error: No hex number starting "0x" found'
endtry
else
echo (a:arg =~? '^0x') ? a:arg + 0 : ('0x'.a:arg) + 0
endif
endfunction