-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvimrc.plugins
375 lines (291 loc) · 11.6 KB
/
vimrc.plugins
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
" Some plug config ( mainly for YCM)
let g:plug_timeout=300
" Start Plug
call plug#begin('~/.config/nvim/plugged')
" Plugins: Proc.vim shell scripting and file stuff --------------------------
Plug 'Shougo/vimproc.vim', {'do': 'make'}
" Plugins: Vim Repeat on steroids
Plug 'tpope/vim-repeat'
" Plugins: Airline -----------------------------------------------------------
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
let g:airline_powerline_fonts=0
let g:airline_theme='base16'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#tabs_label = 'NeoVim'
let g:airline#extensions#tabline#formatter = 'unique_tail'
let g:airline#extensions#tabline#show_splits = 0
let g:airline#extensions#whitespace#enabled = 0
let g:airline#extensions#tabline#show_buffers = 0
let g:airline#extensions#tabline#show_close_button = 0
set noshowmode
" Plugins: Theme
Plug 'chriskempson/vim-tomorrow-theme'
" Plugins: Indent Guides -----------------------------------------------------
Plug 'vim-scripts/Indent-Guides'
colorscheme default
" indent-guides settings
let g:indent_guides_start_level = 2
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_guide_size = 1
let g:indent_guides_color_change_percent = 5
" Plugins: NerdTree base -----------------------------------------------------
Plug 'scrooloose/nerdtree'
" Plugins: NerdTree-git ------------------------------------------------------
Plug 'Xuyuanp/nerdtree-git-plugin'
" Plugins: NerdTree Tabs -----------------------------------------------------
Plug 'jistr/vim-nerdtree-tabs'
" Ctrl-P to Display the file browser tree
nmap <C-P> :NERDTreeTabsToggle<CR>
" ,p to show current file in the tree
nmap <leader>p :NERDTreeFind<CR>
" Plugins: nerdcommenter -----------------------------------------------------
Plug 'scrooloose/nerdcommenter'
let g:NERDSpaceDelims=1
let g:NERDDefaultAlign = 'left'
" ,/ to invert comment on the current line/selection
nmap <leader>/ :call NERDComment(0, "invert")<cr>
vmap <leader>/ :call NERDComment(0, "invert")<cr>
" Plugins: Ag the silver-sarcher ---------------------------------------------
Plug 'rking/ag.vim'
nmap <leader>k :Ag<space>
" Plugins: FZF file search ---------------------------------------------------
if has('unix')
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
endif
Plug 'junegunn/fzf.vim'
if executable("ag") && ('' == $FZF_DEFAULT_COMMAND)
let $FZF_DEFAULT_COMMAND = "ag --follow --nocolor --nogroup -g ''"
endif
set rtp+=/usr/local/opt/fzf/
" :Files with preview
command! FilesP call fzf#vim#files('', fzf#vim#with_preview('right'))
nmap <leader>, :FilesP<cr>
" fuzzy-lines
nmap <leader>l :Lines<cr>
" fuzzy-tags
nmap <leader>t :Tags<cr>
nmap <localleader>t :BTags<cr>
" fuzzy-buffers
nmap <leader>b :Buffers<cr>
" Plugins: CtrlP (on L) ------------------------------------------------------
Plug 'ctrlpvim/ctrlp.vim'
Plug 'd11wtq/ctrlp_bdelete.vim'
let g:ctrlp_clear_cache_on_exit = 1
let g:ctrlp_max_height = 20
" jump to buffer in the same tab if already open
let g:ctrlp_switch_buffer = 0
" if in git repo - use git file listing command, should be faster
" using this option overrides standard CtrlP ignore list based on vim wildignore
" so use 'grep -v ...' to exclude common image and font files from the search
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files --exclude-standard -cod | grep -viE "\.(png|gif|jpg|gz|woff|eot|tiff|ttf|otf)$"']
" open multiple files with <c-z> to mark and <c-o> to open. v - opening in
" vertical splits; j - jump to first open buffer; r - open first in current buffer
let g:ctrlp_open_multiple_files = 'hjr'
let g:ctrlp_extensions = ['tag', 'buffertag', 'quickfix', 'mixed', 'line']
let g:ctrlp_working_path_mode = 'ra'
" prevent CtrlP from adding the default map
let g:ctrlp_map = '<c-l>'
let g:ctrlp_cmd = 'CtrlP'
map <c-l> :CtrlP <CR>
" Plugins: Greplace files ----------------------------------------------------
Plug 'vim-scripts/greplace.vim'
nmap <leader>Gs :Gsearch<cr>
nmap <leader>GS :Gbuffersearch<cr>
nmap <leader>Gr :Greplace<cr>
" replace or edit multiple files at once, then use :Greplace to incorporate
" the changes, followed by :wall to save all modified buffers
if executable("ag")
set grepprg=ag
let g:grep_cmd_opts = '--line-numbers --noheading'
endif
" Plugins: Gundo -------------------------------------------------------------
Plug 'sjl/gundo.vim'
let g:gundo_close_on_revert = 1
nmap <leader>u :GundoToggle<CR>
" Plugins: Vim misc and vim sessions -----------------------------------------
" vim-misc rate-limits, warns and does other misc tasks
Plug 'xolox/vim-misc'
" Vim-session allows to save sessions to later continue with them
Plug 'xolox/vim-session'
let g:session_autosave = 'no'
let g:session_autoload = 'no'
nmap <leader>SS :SaveSession
nmap <leader>SO :OpenSession
if has('gui_running')
nmap <leader>SR :RestartVim<CR>
endif
" Plugins: Vim Switch --------------------------------------------------------
Plug 'AndrewRadev/switch.vim'
" Plugins: Urls to links -----------------------------------------------------
Plug 'vim-scripts/utl.vim'
" config help: <url:~/.config/nvim/plugged/utl_rc.vim#r=utl_cfg_hdl_scm_http>
if has("mac")
let g:utl_cfg_hdl_scm_http_system = "!open '%u'"
end
nmap <leader>o :Utl <space>
" Plugins: Xterm color table -------------------------------------------------
Plug 'guns/xterm-color-table.vim'
" Plugins: yankring ----------------------------------------------------------
Plug 'vim-scripts/YankRing.vim'
let g:yankring_replace_n_pkey = '<leader>['
let g:yankring_replace_n_nkey = '<leader>]'
" put the yankring_history file in ~/.backup
let g:yankring_history_dir = expand('~/.backup')
let g:yankring_max_history = 1000
" ,y to show the yankring
nmap <leader>y :YRShow<cr>
let g:yankring_window_height = 20
" Plugins: Delimate & Endwise closing things automatically -------------------
Plug 'Raimondi/delimitMate'
Plug 'tpope/vim-endwise'
" Turns on/off the expansion of <Space>
let g:delimitMate_expand_space = 1
" Turns on/off the expansion of <CR>
let g:delimitMate_expand_cr = 1
" Plugins: Editorconfig for those .editorconfig files ------------------------
Plug 'editorconfig/editorconfig-vim'
" Plugins: Git things done ---------------------------------------------------
Plug 'tpope/vim-fugitive'
Plug 'vim-scripts/Merginal'
" ,g for Ggrep
nmap <leader>g :silent Ggrep<space>
" ,f for global git serach for word under the cursor (with highlight)
nmap <leader>f :let @/="\\<<C-R><C-W>\\>"<CR>:set hls<CR>:silent Ggrep -w "<C-R><C-W>"<CR>:ccl<CR>:cw<CR><CR>
" same in visual mode
vmap <leader>f y:let @/=escape(@", '\\[]$^*.')<CR>:set hls<CR>:silent Ggrep -F "<C-R>=escape(@", '\\"#')<CR>"<CR>:ccl<CR>:cw<CR><CR>
Plug 'airblade/vim-gitgutter'
Plug 'vitaly/vim-gitignore'
" Plugins: Vim surround turning quotes into other things ---------------------
Plug 'tpope/vim-surround'
" Plugins: Tmux navigator ----------------------------------------------------
Plug 'christoomey/vim-tmux-navigator'
let g:tmux_navigator_no_mappings = 1
nnoremap <silent> <c-w>j :TmuxNavigateDown<cr>
nnoremap <silent> <c-w>k :TmuxNavigateUp<cr>
nnoremap <silent> <c-w>l :TmuxNavigateRight<cr>
nnoremap <silent> <c-w>h :TmuxNavigateLeft<cr>
" Plugins: languages and syntax ----------------------------------------------
" General languages
Plug 'ekalinin/Dockerfile.vim'
Plug 'elzr/vim-json'
let g:vim_json_syntax_conceal = 0
Plug 'tpope/vim-markdown'
Plug 'irrationalistic/vim-tasks'
Plug 'tsaleh/vim-tmux'
Plug 'leafgarland/typescript-vim'
" Javascript
Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'
Plug 'mmalecki/vim-node.js'
" Plugins: Emmet -------------------------------------------------------------
Plug 'mattn/emmet-vim'
" Plugins: Testing -----------------------------------------------------------
Plug 'janko-m/vim-test'
let test#strategy = "vim"
nmap <leader>t :TestNearest --format documentation<cr>
nmap <leader>T :TestFile --format documentation<cr>
" Plugins: Code Completion and lint help -------------------------------------
Plug 'neoclide/coc.nvim', {'do': { -> coc#util#install()}}
let g:coc_global_extensions = [
\ 'coc-json', 'coc-pairs', 'coc-eslint', 'coc-tsserver',
\ 'coc-html', 'coc-css', 'coc-solargraph', 'coc-yaml', 'coc-emmet',
\ 'coc-lists', 'coc-snippets', 'coc-git', 'coc-elixir', 'coc-marketplace',
\ 'coc-webpack', 'coc-lua', 'coc-vimlsp', 'coc-docker', 'coc-tslint']
let g:coc_user_config = {
\ "diagnostic.errorSign": '⚠',
\ "diagnostic.warningSign": '⚐',
\ "diagnostic.infoSign": '⚐',
\ "diagnostic.hintSign": '⚐',
\ "diagnostic.signOffset": 100,
\ "coc.preferences.enableFloatHighlight": v:false,
\ }
let g:airline#extensions#coc#enabled = 1
let airline#extensions#coc#stl_format_err = '%E{[%e(#%fe)] }'
let airline#extensions#coc#stl_format_warn = '%W{[%w(#%fw)]} '
" highlight clear CocErrorSign
" highlight clear CocWarningSign
" hi link CocErrorSign GitGutterDelete
" hi link CocWarningSign WarningMsg
" if hidden is not set, TextEdit might fail.
" set hidden
" Some servers have issues with backup files, see #649
set nobackup
set nowritebackup
" don't give |ins-completion-menu| messages.
set shortmess+=c
" You will have bad experience for diagnostic messages when it's default 4000.
set updatetime=300
" always show signcolumns
set signcolumn=yes
" Use tab for trigger completion with characters ahead and navigate.
" Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
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
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
" Remap for rename current word
nmap <leader>rn <Plug>(coc-rename)
" Highlight symbol under cursor on CursorHold
autocmd CursorHold * silent call CocActionAsync('highlight')
" Jumpers - I'll remove some of those sometime
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Next and previous navigation
nmap <silent><leader>m <Plug>(coc-diagnostic-next)
nmap <silent><leader>M <Plug>(coc-diagnostic-prev)
" Plugins: Ale linter --------------------------------------------------------
Plug 'w0rp/ale'
" Remaps
nmap <silent> <C-K> <Plug>(ale_previous_wrap)
nmap <silent> <C-J> <Plug>(ale_next_wrap)
" Icons
let g:ale_sign_error = '⚠'
let g:ale_sign_warning = '⚐'
highlight clear ALEErrorSign
highlight clear ALEWarningSign
hi link ALEErrorSign GitGutterDelete
hi link ALEWarningSign Todo
" Dissabled linters (since COC takes care of these)
let g:ale_linters = {
\ 'css': [],
\ 'javascript': [],
\ 'typescript': [],
\ 'json': [],
\ 'scss': [],
\ 'yaml': []
\ }
" Autofixing
let g:ale_fixers = {
\ '*': ['trim_whitespace', 'remove_trailing_lines'],
\ 'javascript': ['eslint'],
\ 'typescript': ['eslint', 'tslint'],
\ 'ruby': ['rubocop'],
\ 'markdown': ['prettier'],
\ 'scss': ['stylelint'],
\ 'elixir': ['mix_format']
\ }
let g:ale_fix_on_save = 1
" Airline integration
let g:airline#extensions#ale#enabled = 1
let g:ale_statusline_format = ['⚠ %d', '⚠ %d', '']
let g:ale_echo_msg_error_str = '⚠'
let g:ale_echo_msg_warning_str = '⚐'
" End Plug
call plug#end()
" Automatically executes 'filetype plugin indent on' and 'syntax enable'