-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.vim
359 lines (299 loc) · 10 KB
/
init.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
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
let $BAT_THEME='Coldark-Cold'
set termguicolors
set sw=4
set ts=4
set expandtab
set hidden
set listchars=tab:»\ ,extends:›,precedes:‹,nbsp:·,trail:·,eol:⨼
set list!
set undofile
set undodir=~/.config/nvim/undodir
set undolevels=1000
set undoreload=10000
set noswapfile
set noshowmode
filetype on
set virtualedit=
set wildmenu
set wildmode=full
set complete=.,w,b,u,t,k
set autoindent
set smartindent
set incsearch
set inccommand=split
set foldmethod=manual
set mouse=a
set cmdheight=2
set updatetime=300
set shortmess+=c
set suffixesadd=.js,.jsx,.ts,.tsx
botright cwindow
" let g:loaded_python_provider = 1
" let g:python_host_prog='/usr/bin/python3'
let g:python3_host_prog='/usr/local/bin/python3'
let g:EditorConfig_exclude_patterns = ['fugitive://.\*']
let &t_Cs = "\e[4:3m"
let &t_Ce = "\e[4:3m"
let g:gh_color = "soft"
let g:vim_monokai_tasty_italic = 1
hi SpellBad gui=undercurl guisp=red term=undercurl cterm=undercurl
call plug#begin('~/.local/share/nvim/plugged')
Plug 'metakirby5/codi.vim'
Plug 'pantharshit00/vim-prisma'
Plug 'keith/swift.vim'
Plug 'patstockwell/vim-monokai-tasty'
Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'
Plug 'elzr/vim-json'
Plug 'jeetsukumaran/vim-indentwise'
Plug 'editorconfig/editorconfig-vim'
Plug 'tpope/vim-abolish'
Plug 'w0rp/ale'
Plug 'szorfein/fromthehell.vim'
Plug 't9md/vim-quickhl'
Plug 'nightsense/stellarized'
Plug 'iloginow/vim-stylus'
Plug 'cormacrelf/vim-colors-github'
Plug 'wojciechkepka/vim-github-dark'
Plug 'AndrewRadev/switch.vim'
Plug 'airblade/vim-gitgutter'
Plug 'FooSoft/vim-argwrap'
" Plug 'SirVer/ultisnips'
Plug 'zooxyt/Ultisnips-rust'
Plug 'tomtom/tcomment_vim'
Plug 'mechatroner/rainbow_csv'
Plug 'rust-lang/rust.vim'
Plug 'neomake/neomake'
Plug 'tpope/vim-dispatch'
Plug 'moll/vim-node'
Plug 'wmonk/vim-makegreen'
" Plug 'vim-test/vim-test'
Plug 'kassio/neoterm'
Plug 'sbdchd/neoformat'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-vinegar'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'christoomey/vim-tmux-navigator'
Plug 'morhetz/gruvbox'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'alexbyk/vim-ultisnips-js-testing'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'roxma/nvim-yarp'
Plug 'wmonk/vim-react-snippets'
Plug 'epilande/vim-es2015-snippets'
Plug 'bogado/file-line'
Plug 'Raimondi/delimitMate'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'antoinemadec/coc-fzf', {'branch': 'release'}
Plug 'mbbill/undotree'
call plug#end()
let mapleader = "\<Space>"
set relativenumber
nnoremap ; :
imap jk <Esc>:w<CR>
imap jk <Esc>
map <Leader>q :x<CR>
map <Leader>w :w<CR>
map <Leader>f :Neoformat<CR>
map <esc> :noh<cr>
tmap <esc> <c-\><c-n><esc><cr>
" set background=dark
" let g:gruvbox_contrast_dark="hard"
" colorscheme gruvbox
if strftime("%H") < 20
set background=light
" more blocky diff markers in signcolumn (e.g. GitGutter)
let g:github_colors_soft = 1
let g:github_colors_block_diffmark = 1
set background=light
colorscheme github
else
colorscheme ghdark
endif
noremap <silent> <C-l> <c-w>l
tnoremap <silent> <C-l> <C-\><C-n><c-w>l
noremap <silent> <C-h> <c-w>h
tnoremap <silent> <C-h> <C-\><C-n><c-w>h
noremap <silent> <C-k> <c-w>k
tnoremap <silent> <C-k> <C-\><C-n><c-w>k
noremap <silent> <C-j> <c-w>j
map <C-p> :GFiles<CR>
function! Rgerium()
let params = input('Search files for: ')
execute 'Rg ' . params
endfunction
map <Leader>i :call Rgerium()<CR>
vmap <Leader>i y:Rg <C-R>"<CR>
vmap " S"
vmap B SB
vmap b Sb
vmap ] S]
vmap [ S[
map <Leader>g :GFiles?<CR>
map <Leader>b :Buffers<CR>
map <Leader>l :Lines<CR>
map <C-\-> :FZF <c-r>=fnameescape(expand('%:p:h'))<cr>/<cr>
imap <c-x><c-f> <plug>(fzf-complete-path)
command! -bang -nargs=* Rg
\ call fzf#vim#grep(
\ 'rg --column --line-number --no-heading --color=always --smart-case -- '.shellescape(<q-args>), 1,
\ fzf#vim#with_preview(), <bang>0)
" command! -bang -nargs=* Rg
" \ call fzf#vim#grep(
" \ 'rg --column --line-number --no-heading --color=always --smart-case '.shellescape(<q-args>), 1,
" \ <bang>0 ? fzf#vim#with_preview('up:60%')
" \ : fzf#vim#with_preview('right:50%:hidden', '?'),
" \ <bang>0)
command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(<q-args>, fzf#vim#with_preview(), <bang>0)
" Global line completion (not just open buffers. ripgrep required.)
inoremap <expr> <c-x><c-l> fzf#vim#complete(fzf#wrap({
\ 'prefix': '^.*$',
\ 'source': 'rg -n ^ --color always',
\ 'options': '--ansi --delimiter : --nth 3..',
\ 'reducer': { lines -> join(split(lines[0], ':\zs')[2:], '') }}))
function! s:build_quickfix_list(lines)
call setqflist(map(copy(a:lines), '{ "filename": v:val }'))
copen
cc
endfunction
let g:fzf_action = {
\ 'ctrl-q': function('s:build_quickfix_list'),
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': 'split',
\ 'ctrl-v': 'vsplit' }
let $FZF_DEFAULT_OPTS = '--bind ctrl-a:select-all'
nnoremap <Leader>j :cp<CR>
nnoremap <Leader>c :copen<CR>
nnoremap <Leader>s :source ~/.config/nvim/test.vim<CR>
function! ExecuteMacroOverVisualRange()
echo "@".getcmdline()
execute ":'<,'>normal @".nr2char(getchar())
endfunction
xnoremap @ :<C-u>call ExecuteMacroOverVisualRange()<CR>
" Use <C-l> for trigger snippet expand.
imap <C-l> <Plug>(coc-snippets-expand)
inoremap <expr> <C-l> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" Use <C-j> for select text for visual placeholder of snippet.
vmap <C-j> <Plug>(coc-snippets-select)
" Use <leader>x for convert visual selected code to snippet
xmap <leader>x <Plug>(coc-convert-snippet)
" Use <C-j> for jump to next placeholder, it's default of coc.nvim
let g:coc_snippet_next = '<c-j>'
" Use <C-k> for jump to previous placeholder, it's default of coc.nvim
let g:coc_snippet_prev = '<c-k>'
" Use <C-j> for both expand and jump (make expand higher priority.)
imap <C-j> <Plug>(coc-snippets-expand-jump)
let g:neoformat_enabled_python = ['black']
let g:neoformat_enabled_javascript = ['prettier']
vnoremap <Leader>y "+y
nnoremap <Leader>Y "+yg_
nnoremap <Leader>y "+y
nnoremap <Leader>yy "+yy
nnoremap <Leader>p "+p
nnoremap <Leader>P "+P
vnoremap <Leader>p "+p
vnoremap <Leader>P "+P
" let g:test#javascript#jest#file_pattern = '\vtests?\.(js|jsx|coffee|ts|tsx)$'
" let g:test#javascript#jest#options = '--reporters jest-simple-reporter'
" noremap <Leader>t :TestFile -strategy=neomake<cr>
noremap <Leader>s *Nciw
noremap <Leader>r yiw:%s/<C-r>"/
function s:Bar(type, msg)
if a:type == "red"
echohl RedBar
else
echohl GreenBar
endif
echon a:msg repeat(" ", &columns - strlen(a:msg) - 1)
echohl None
endfunction
function! MyOnNeomakeJobFinished() abort
let context = g:neomake_hook_context
if context.jobinfo.exit_code != 0
call s:Bar("red", "There was an error")
else
call s:Bar("green", "All good")
endif
endfunction
augroup my_neomake_hooks
au!
autocmd User NeomakeJobFinished call MyOnNeomakeJobFinished()
augroup END
let g:LanguageClient_loggingFile = '/tmp/LanguageClient.log'
let g:LanguageClient_serverStderr = '/tmp/LanguageServer.log'
nnoremap <silent> <Leader>a :ArgWrap<CR>
autocmd FileType rust let b:switch_custom_definitions =
\ [
\ {
\ '&\(.\+\)': '\1'
\ }
\ ]
highlight ExtraWhitespace guisp=red
match ExtraWhitespace /\s\+$/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()
" Disable tmux navigator when zooming the Vim pane
let g:tmux_navigator_disable_when_zoomed = 1
au BufNewFile,BufRead,BufReadPost Pipfile set ft=cfg
au BufNewFile,BufRead,BufReadPost .babelrc set ft=json
nmap <Space>m <Plug>(quickhl-manual-this)
xmap <Space>m <Plug>(quickhl-manual-this)
nmap <Space>M <Plug>(quickhl-manual-reset)
xmap <Space>M <Plug>(quickhl-manual-reset)
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
inoremap <silent><expr> <c-s> coc#refresh()
" Remap <C-f> and <C-b> for scroll float windows/popups.
" Note coc#float#scroll works on neovim >= 0.4.0 or vim >= 8.2.0750
nnoremap <nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
nnoremap <nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
inoremap <nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
inoremap <nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
vnoremap <nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#nvim_scroll(1, 1) : "\<C-f>"
vnoremap <nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#nvim_scroll(0, 1) : "\<C-b>"
" nmap <silent> <C-s> <Plug>(coc-range-select)
" xmap <silent> <C-s> <Plug>(coc-range-select)
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)
noremap <Leader>o :CocFzfList outline<cr>
noremap <Leader>d :CocFzfList diagnostics<cr>
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
autocmd CursorHold * silent call CocActionAsync('highlight')
nmap <leader>rn <Plug>(coc-rename)
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
" Remap for do codeAction of current line
nmap <leader>ac <Plug>(coc-codeaction)
" Fix autofix problem of current line
nmap <leader>qf <Plug>(coc-fix-current)
" Run the Code Lens action on the current line.
nmap <leader>cl <Plug>(coc-codelens-action)
xmap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap if <Plug>(coc-funcobj-i)
omap af <Plug>(coc-funcobj-a)
" inoremap <silent><expr> <TAB>
" \ pumvisible() ? coc#_select_confirm() :
" \ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
" \ <SID>check_back_space() ? "\<TAB>" :
" \ coc#refresh()
"
autocmd BufEnter *.tsx set filetype=typescript.tsx