-
Notifications
You must be signed in to change notification settings - Fork 2
/
plugins.vim
166 lines (138 loc) · 4.64 KB
/
plugins.vim
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
if empty(glob('~/.vim/bundle'))
autocmd VimEnter * PlugInstall
endif
" Plugin Declarations {{{
call plug#begin('~/.vim/bundle')
" Appearance
Plug 'blueyed/vim-diminactive'
Plug 'noahfrederick/vim-noctu'
Plug 'sheerun/vim-polyglot'
" Code Completion
Plug 'honza/vim-snippets', { 'on': [] }
Plug 'jiangmiao/auto-pairs'
Plug 'shougo/neocomplete.vim', { 'on': [] }
Plug 'sirver/ultisnips', { 'on': [] }
Plug 'tpope/vim-endwise', { 'on': [] }
" Lint
Plug 'prettier/vim-prettier', { 'do': 'yarn install', 'on': [ 'Prettier', 'PrettierAsync' ] }
Plug 'w0rp/ale', { 'on': [] }
" Misc
Plug 'junegunn/vim-slash'
Plug 'mhinz/vim-signify'
Plug 'obxhdx/vim-action-mapper'
Plug 'obxhdx/vim-auto-highlight'
Plug 'tpope/vim-commentary', { 'on': '<Plug>Commentary' }
Plug 'tpope/vim-rsi'
Plug 'tpope/vim-surround'
" Navigation
Plug 'kopischke/vim-fetch'
Plug 'tmhedberg/matchit'
" Tools
Plug 'christoomey/vim-tmux-navigator'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'on': ['FzBuffers', 'FzCommands', 'FzFiles', 'FzHistory', 'FzRg'] }
Plug 'junegunn/fzf.vim', { 'on': ['FzBuffers', 'FzCommands', 'FzFiles', 'FzHistory', 'FzRg'] }
Plug 'metakirby5/codi.vim', { 'on': 'Codi' }
call plug#end()
" }}}
" On-demand Loading {{{
augroup LoadCompletionPlugins
autocmd!
autocmd InsertEnter * call plug#load('ale', 'neocomplete.vim', 'ultisnips', 'vim-endwise', 'vim-snippets')
\| echo 'Snippets + Completion plugins loaded!'
\| autocmd! LoadCompletionPlugins
augroup END
" }}}
" ActionMapper {{{
function! FindAndReplaceWithWordBoundary(text)
let l:use_word_boundary = 1
execute s:FindAndReplace(a:text, l:use_word_boundary)
endfunction
function! FindAndReplaceWithoutWordBoundary(text)
let l:use_word_boundary = 0
execute s:FindAndReplace(a:text, l:use_word_boundary)
endfunction
function! s:FindAndReplace(text, use_word_boundary)
let l:pattern = a:use_word_boundary ? '<'.a:text.'>' : a:text
let l:new_text = input('Replace '.l:pattern.' with: ', a:text)
if len(l:new_text)
execute ',$s/\v'.l:pattern.'/'.l:new_text.'/gc'
endif
endfunction
function! GrepWithFZF(text)
execute 'FzRg '.a:text
endfunction
autocmd! User MapActions
autocmd User MapActions call MapAction('GrepWithFZF', '<leader>g')
autocmd User MapActions call MapAction('FindAndReplaceWithWordBoundary', '<leader>r')
autocmd User MapActions call MapAction('FindAndReplaceWithoutWordBoundary', '<leader><leader>r')
"}}}
" Ale {{{
let g:ale_sign_error = '●'
let g:ale_sign_warning = '●'
au ColorScheme * hi ALEErrorSign ctermfg=red
au ColorScheme * hi ALEWarningSign ctermfg=yellow
" }}}
" AutoHighlightWord {{{
au VimEnter * hi! AutoHighlightWord ctermbg=238
set updatetime=500 " Make CursorHold trigger faster
" }}}
" Colorscheme {{{
augroup ColorTweaks
autocmd!
autocmd ColorScheme *
\ hi ColorColumn ctermbg=237 |
\ hi CursorLine ctermbg=237 |
\ hi CursorLineNr ctermbg=NONE ctermfg=white |
\ hi LineNr ctermbg=NONE |
\ hi Pmenu ctermbg=13 ctermfg=black |
\ hi StatusLine cterm=reverse |
\ hi StatusLineNC cterm=NONE ctermbg=239 ctermfg=white |
\ hi VertSplit ctermfg=240 |
\ hi! link Folded Comment |
augroup END
try
colorscheme noctu
catch | endtry
" }}}
" Commentary {{{
map gc <Plug>Commentary
nmap gcc <Plug>CommentaryLine
" }}}
" FZF {{{
let g:fzf_command_prefix = 'Fz'
let g:fzf_files_options = '--tiebreak=end' " Prioritize matches that are closer to the end of the string
nnoremap <Leader>b :FzBuffers<CR>
nnoremap <Leader>c :FzCommands<CR>
nnoremap <Leader>f :FzFiles<CR>
nnoremap <Leader>h :FzHistory<CR>
command! -bang -nargs=* FzRg
\ call fzf#vim#grep(
\ 'rg --column --line-number --no-heading --color=always '.shellescape(<q-args>), 1,
\ <bang>0 ? fzf#vim#with_preview('up:60%')
\ : fzf#vim#with_preview('right:50%:hidden', '?'),
\ <bang>0)
" }}}
" Neocomplete {{{
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_smart_case = 1
"}}}
" Signify {{{
hi SignifySignAdd ctermfg=green
hi SignifySignChange ctermfg=yellow
hi SignifySignDelete ctermfg=red
let g:signify_sign_add = '│'
let g:signify_sign_delete = '│'
let g:signify_sign_delete_first_line = '│'
let g:signify_sign_change = '│'
let g:signify_sign_changedelete = g:signify_sign_change
"}}}
" Slash {{{
nnoremap <silent> <plug>(slash-after) :execute 'match IncSearch /\c\%'.virtcol('.').'v\%'.line('.').'l'.@/.'/'<CR>
autocmd CursorMoved * call clearmatches()
"}}}
" UltiSnips {{{
let g:UltiSnipsExpandTrigger = "<tab>"
let g:UltiSnipsJumpForwardTrigger = "<tab>"
let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"
"}}}
" vim: set foldmethod=marker foldenable :