-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathplugins.vim
More file actions
402 lines (354 loc) · 14.4 KB
/
Copy pathplugins.vim
File metadata and controls
402 lines (354 loc) · 14.4 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
call plug#begin('~/.vim/plugged')
Plug 'airblade/vim-gitgutter'
Plug 'ap/vim-css-color'
Plug 'bkad/CamelCaseMotion'
Plug 'briancollins/vim-jst'
Plug 'cakebaker/scss-syntax.vim'
Plug 'digitaltoad/vim-pug'
Plug 'elixir-lang/vim-elixir'
Plug 'elzr/vim-json'
Plug 'flazz/vim-colorschemes'
Plug 'henrik/vim-indexed-search'
Plug 'int3/vim-extradite'
Plug 'vim-scripts/matchit.zip'
Plug 'mhinz/vim-hugefile'
Plug 'slim-template/vim-slim'
Plug 'sstephenson/eco'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-haml'
Plug 'tpope/vim-rhubarb'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-abolish'
Plug 'morr/vim-ruby'
Plug 'vim-scripts/grep.vim'
Plug 'jparise/vim-graphql'
Plug 'keithbsmiley/rspec.vim'
"-----------------------------------------------------------------------------
" javascript
"-----------------------------------------------------------------------------
Plug 'morr/vim-javascript'
Plug 'mxw/vim-jsx'
"-----------------------------------------------------------------------------
" styles
"-----------------------------------------------------------------------------
Plug 'aunsira/macvim-light'
Plug 'davidklsn/vim-sialoquent'
Plug 'dim13/smyck.vim'
Plug 'hzchirs/vim-material'
Plug 'hzchirs/vim-material'
Plug 'lu-ren/SerialExperimentsLain'
Plug 'mom0tomo/dotfiles'
Plug 'nightsense/carbonized'
Plug 'nightsense/seabird'
Plug 'rakr/vim-one'
Plug 'rhysd/vim-color-spring-night'
Plug 'tomasr/molokai'
Plug 'zcodes/vim-colors-basic'
"-----------------------------------------------------------------------------
" rust
"-----------------------------------------------------------------------------
Plug 'rust-lang/rust.vim'
"-----------------------------------------------------------------------------
" CoC
"-----------------------------------------------------------------------------
let g:coc_global_extensions = ['coc-rust-analyzer', 'coc-solargraph']
Plug 'neoclide/coc.nvim', { 'branch': 'release' }
" Plug 'neoclide/coc.nvim', { 'branch': 'release', 'do': 'brew list solargraph \|\| brew install solargraph' }
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
" inoremap <silent><expr> <TAB>
" \ pumvisible() ? "\<C-n>" :
" \ <SID>check_back_space() ? "\<TAB>" :
" \ coc#refresh()
" inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
"
" function! s:check_back_space() abort
" let col = col('.') - 1
" return !col || getline('.')[col - 1] =~# '\s'
" endfunction
" Make <CR> auto-select the first completion item and notify coc.nvim to
" format on enter, <cr> could be remapped by other vim plugin
" inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
" Use K to show documentation in preview window.
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
elseif (coc#rpc#ready())
call CocActionAsync('doHover')
else
execute '!' . &keywordprg . " " . expand('<cword>')
endif
endfunction
" Use `[g` and `]g` to navigate diagnostics
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
au BufNewFile,BufRead *.rb nnoremap <silent> ,R :w<cr>:silent !rubocop --auto-correct %<cr>:edit!<cr>
au BufNewFile,BufRead *.js nnoremap <silent> ,R :w<cr>:silent !yarn run eslint --fix %<cr>:edit!<cr>
au BufNewFile,BufRead *.jsx nnoremap <silent> ,R :w<cr>:silent !yarn run eslint --fix %<cr>:edit!<cr>
au BufNewFile,BufRead *.vue nnoremap <silent> ,R :w<cr>:silent !yarn run eslint --fix %<cr>:edit!<cr>
"-----------------------------------------------------------------------------
Plug 'posva/vim-vue'
"-----------------------------------------------------------------------------
au BufNewFile,BufRead *.vue setf vue
" https://github.com/posva/vim-vue#how-to-use-commenting-functionality-with-multiple-languages-in-vue-files
au FileType vue syntax sync fromstart
" Vim slows down when using this plugin How can I fix that?
let g:vue_pre_processors = ['pug', 'sass']
"-----------------------------------------------------------------------------
Plug 'tpope/vim-fugitive'
"-----------------------------------------------------------------------------
autocmd User fugitive
\ if get(b:, 'fugitive_type', '') =~# '^\%(tree\|blob\)$' |
\ nnoremap <buffer> .. :edit %:h<CR> |
\ endif
autocmd BufReadPost fugitive://* set bufhidden=delete
set diffopt+=vertical
" nnoremap <f5> :Gcommit<cr>
" inoremap <f5> <c-O>:Gcommit<cr>
" vnoremap <f5> <esc>:Gcommit<cr>
nnoremap <f6> :Gdiff<cr>
inoremap <f6> <c-O>:Gdiff<cr>
vnoremap <f6> <esc>:Gdiff<cr>
"-----------------------------------------------------------------------------
Plug 'ervandew/supertab'
"-----------------------------------------------------------------------------
let g:SuperTabDefaultCompletionType = '<C-n>'
"-----------------------------------------------------------------------------
Plug 'jeetsukumaran/vim-buffergator'
"-----------------------------------------------------------------------------
let g:buffergator_suppress_keymaps = 1
nnoremap <silent> <Leader>b :BuffergatorToggle<CR>
"-----------------------------------------------------------------------------
Plug '/opt/homebrew/opt/fzf'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
"-----------------------------------------------------------------------------
nmap <leader>t :Files<cr>
nmap <leader>r :Rg<cr>
nmap <leader>b :Buffers<cr>
" Nord theme https://github.com/junegunn/fzf/wiki/Color-schemes#nord
let color_scheme_options = 'fg:#D8DEE9,bg:#2E3440,hl:#A3BE8C,fg+:#D8DEE9,bg+:#434C5E,hl+:#A3BE8C,pointer:#BF616A,info:#4C566A,spinner:#4C566A,header:#4C566A,prompt:#81A1C1,marker:#EBCB8B'
let $BAT_THEME='Nord'
" https://github.com/junegunn/fzf/blob/master/README-VIM.md#fzf
let $FZF_DEFAULT_OPTS = '--layout=reverse --color='.color_scheme_options
let $FZF_DEFAULT_COMMAND = 'fd --type file --hidden --follow --ignore-file .gitignore -E .git -E node_modules -E tmp'
let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.8 } }
" [Buffers] Do not Jump to the existing window if possible
let g:fzf_buffers_jump = 0
" default rip grep search behaviour but with hidden files included
command! -bang -nargs=* Rg
\ call fzf#vim#grep("rg --hidden --column --line-number --no-heading --color=always --smart-case -- ".shellescape(<q-args>), 1, fzf#vim#with_preview(), <bang>0)
"-----------------------------------------------------------------------------
Plug 'scrooloose/nerdtree'
"-----------------------------------------------------------------------------
map <silent> <leader>n :NERDTreeToggle<cr>
map <silent> <leader>N :NERDTreeFind<cr>
nmap <f2> :NERDTreeFind<cr>
nmap <f3> :NERDTreeToggle<cr>
let g:NERDTreeIgnore = ['node_modules']
"-----------------------------------------------------------------------------
" replacement for nerdcommenter that works for vue
Plug 'tyru/caw.vim'
Plug 'Shougo/context_filetype.vim'
"-----------------------------------------------------------------------------
map ,<space> <plug>(caw:hatpos:toggle)
" "-----------------------------------------------------------------------------
" Plug 'dense-analysis/ale'
" "-----------------------------------------------------------------------------
" " only linters from g:ale_linters are enabled
" let g:ale_linters_explicit = 1
"
" " hi ALEWarningSign guibg=#FDE1FD guifg=#0512FB gui=bold
" " hi ALEErrorSign guibg=#F4DBDC guifg=#662529 gui=bold
"
" " location list is populated by default -
" " this might overwrite the contents of already
" " opened location list (e.g., search results)
" let g:ale_set_loclist = 0
" let g:ale_set_quickfix = 0
"
" let g:ale_sign_warning = 'W>'
" let g:ale_sign_error = 'E>'
"
" let g:ale_lint_on_filetype_changed = 1
" let g:ale_lint_on_save = 1
" let g:ale_lint_on_text_changed = 'never'
" let g:ale_lint_on_insert_leave = 0
" let g:ale_lint_on_enter = 1
"
" " virtual-text is broken when it displayed in wrapped state
" let g:ale_virtualtext_cursor = 0
"
" let g:ale_linters = {
"\ 'elixir': ['credo'],
"\ 'javascript': ['eslint'],
"\ 'vue': ['eslint'],
"\ 'ruby': ['rubocop']
"\ }
"
" au BufNewFile,BufRead *.rb nnoremap <silent> ,R :w<cr>:silent !rubocop --auto-correct %<cr>:edit!<cr>
" au BufNewFile,BufRead *.js nnoremap <silent> ,R :w<cr>:silent !yarn run eslint --fix %<cr>:edit!<cr>
" au BufNewFile,BufRead *.jsx nnoremap <silent> ,R :w<cr>:silent !yarn run eslint --fix %<cr>:edit!<cr>
" au BufNewFile,BufRead *.vue nnoremap <silent> ,R :w<cr>:silent !yarn run eslint --fix %<cr>:edit!<cr>
"-------------------------------------------------------------------------------
Plug 'tpope/vim-rails'
"-------------------------------------------------------------------------------
nmap <F4> :A<CR>
nmap <Leader><F4> :AV<CR>
nmap gs :AV<cr>
nmap gS :A<cr>
" example projections: https://gist.github.com/henrik/5676109
let g:rails_projections = {
\ 'app/*.rb': {
\ 'alternate': 'spec/{}_spec.rb'
\ },
\ 'app/admin/*.rb': {
\ 'alternate': 'spec/controllers/admin/{}_controller_spec.rb'
\ },
\ 'spec/controllers/admin/*_controller_spec.rb': {
\ 'alternate': 'app/admin/{}.rb'
\ },
\ 'config/locales/*ru.yml': {
\ 'alternate': 'config/locales/{}en.yml'
\ },
\ 'config/locales/*en.yml': {
\ 'alternate': 'config/locales/{}ru.yml'
\ }
\ }
"-------------------------------------------------------------------------------
Plug 'tap349/ack.vim'
"-------------------------------------------------------------------------------
let g:ackprg = 'rg --fixed-strings --smart-case --ignore-file $HOME/.agignore --vimgrep'
" disable empty search (searching the word under cursor) -
" it complicates the logic to parse user input excessively
"
" use <C-r><C-w> to paste the word under cursor
let g:ack_use_cword_for_empty_search = 0
" QFEnter works with both quickfix windows and location lists
map <Leader>/ :call <SID>Search()<CR>
map <Leader>\ :call <SID>SearchWithGlob()<CR>
function! s:Search()
echohl AckSearch
let l:input_phrase = input('⎸SEARCH > ')
echohl None
call <SID>MyLAck(l:input_phrase, '')
endfunction
function! s:SearchWithGlob()
echohl AckSearch
let l:input_phrase = input('⎸SEARCH [1/2] > ')
redraw!
let l:glob = input('⎸GLOB [2/2] > ')
echohl None
call <SID>MyLAck(l:input_phrase, l:glob)
endfunction
" `!` is not allowed in function name
"
" https://github.com/mileszs/ack.vim/issues/5
" https://stackoverflow.com/a/15403852/3632318
" https://stackoverflow.com/questions/5669194
" :help escape()
" :help shellescape()
"
" for rg to work we need:
"
" - not to escape `!` at all
" - to escape `%#` twice
" - to escape other special characters (slashes, etc.) once
" - not to treat strings starting with dashes as rg options
"
" useful functions:
"
" - `shellescape({string})`:
" escapes all special characters once (excluding `!%#`)
" - `shellescape({string}, 1)`:
" escapes all special characters once (including `!%#`)
" - `escape({string}, {chars})`:
" escapes only the characters it's told to escape
" - `--` (options delimiter):
" signifies the end of rg options
"
" => escape all special characters excluding `!%#` with
" `shellescape`, escape `%#` with `escape` twice
" and let `--` deal with strings starting with dashes
function! s:MyLAck(input_phrase, ...)
let l:glob = get(a:, 1, '')
let l:glob_option = len(l:glob) ? '-g ''*' . l:glob . '*''' : ''
let l:delimiter = ' -- '
let l:split_args = split(a:input_phrase, l:delimiter)
let l:args_len = len(l:split_args)
" no arguments
if l:args_len == 0
call <SID>ShowWarningMessage('Empty search')
return
" options only (`-w -- `)
elseif l:args_len == 1 && a:input_phrase =~ l:delimiter . '$'
call <SID>ShowWarningMessage('Empty search')
return
" search phrase only (` -- foo` or `foo`)
elseif l:args_len == 1
let l:options = l:glob_option
let l:search_phrase = join(l:split_args)
" options and search phrase
else
let l:options = l:glob_option . ' ' . l:split_args[0]
let l:search_phrase = join(l:split_args[1:-1], l:delimiter)
endif
" ack.vim already escapes `|%#` once in autoload/ack.vim -
" escape `%#` once again here so that they're escaped twice
let l:escaped_search_phrase = escape(shellescape(l:search_phrase), '%#')
" don't use `silent` - it suppresses 'no match found' message
"
" search might break if ' -- ' is a substring of search phrase
" and user doesn't provide options - then part of search phrase
" is parsed as options which might yield unpredictable results
exec ':LAck! ' . l:options . l:delimiter . l:escaped_search_phrase
endfunction
function! s:ShowWarningMessage(message)
redraw!
echohl WarningMsg
echo a:message
echohl None
endfunction
"-----------------------------------------------------------------------------
Plug 'tpope/vim-repeat'
"-----------------------------------------------------------------------------
silent! call repeat#set("\<Plug>MyWonderfulMap", v:count)
"-------------------------------------------------------------------------------
Plug 'tap349/QFEnter'
" QFEnter respects `switchbuf` option! if selected file is opened
" in another tab all mappings below just switch to that tab
"-------------------------------------------------------------------------------
" disable automatic opening of quickfix window (or location list)
" when opening file from current quickfix window in a new tab
let g:qfenter_enable_autoquickfix = 0
let g:qfenter_keymap = {}
let g:qfenter_keymap.open = ['<C-CR>']
let g:qfenter_keymap.open_keep = ['<S-CR>']
let g:qfenter_keymap.open_close = ['<CR>']
let g:qfenter_keymap.hopen = ['<C-s>']
let g:qfenter_keymap.vopen = ['<C-v>']
let g:qfenter_keymap.topen = ['<C-t>']
"-----------------------------------------------------------------------------
Plug 'osyo-manga/vim-anzu'
"-----------------------------------------------------------------------------
nmap * <Plug>(anzu-star)
nmap # <Plug>(anzu-sharp)
nmap n <Plug>(anzu-mode-n)
nmap N <Plug>(anzu-mode-N)
"-----------------------------------------------------------------------------
" Plug 'haya14busa/vim-asterisk'
"-----------------------------------------------------------------------------
" map * <Plug>(asterisk-*)
" map # <Plug>(asterisk-#)
" map g* <Plug>(asterisk-g*)
" map g# <Plug>(asterisk-g#)
" map z* <Plug>(asterisk-z*)
" map gz* <Plug>(asterisk-gz*)
" map z# <Plug>(asterisk-z#)
" map gz# <Plug>(asterisk-gz#)
" Initialize plugin system
call plug#end()