@@ -2,6 +2,7 @@ call plug#begin('~/.vim/plugged')
2
2
3
3
" LSP
4
4
Plug ' neovim/nvim-lspconfig'
5
+ Plug ' hrsh7th/compe'
5
6
" LSPInstall
6
7
" tsserver
7
8
@@ -51,6 +52,8 @@ Plug 'NLKNguyen/papercolor-theme'
51
52
Plug ' ayu-theme/ayu-vim'
52
53
Plug ' sonph/onehalf' , {' rtp' : ' vim' }
53
54
55
+ " Prettier
56
+ Plug ' sbdchd/neoformat'
54
57
55
58
call plug#end ()
56
59
@@ -345,16 +348,25 @@ nnoremap <leader>ph :lua require('telescope.builtin').help_tags()<CR>
345
348
" CoC remaps
346
349
347
350
" edit snippets
348
- nmap <leader> sn :CocCommand snippets.editSnippets<CR>
351
+ " nmap <leader>sn :CocCommand snippets.editSnippets<CR>
349
352
" go to definition
350
- nmap <silent> <leader> gd <Plug> (coc-definition)
353
+ " nmap <silent> <leader>gd <Plug>(coc-definition)
351
354
" go to type definition
352
- nmap <silent> <leader> gt <Plug> (coc-type-definition)
355
+ " nmap <silent> <leader>gt <Plug>(coc-type-definition)
353
356
" go to implementation
354
- nmap <silent> <leader> gi <Plug> (coc-implementation)
357
+ " nmap <silent> <leader>gi <Plug>(coc-implementation)
355
358
" go to references
356
- nmap <silent> <leader> gr <Plug> (coc-references)
359
+ " nmap <silent> <leader>gr <Plug>(coc-references)
357
360
361
+ " LSP remaps
362
+ nnoremap <silent> gd <cmd> lua vim.lsp.buf.definition()<CR>
363
+ nnoremap <silent> gD <cmd> lua vim.lsp.buf.declaration()<CR>
364
+ nnoremap <silent> gr <cmd> lua vim.lsp.buf.references()<CR>
365
+ nnoremap <silent> gi <cmd> lua vim.lsp.buf.implementation()<CR>
366
+ nnoremap <silent> K <cmd> lua vim.lsp.buf.hover()<CR>
367
+ nnoremap <silent> <C-k> <cmd> lua vim.lsp.buf.signature_help()<CR>
368
+ nnoremap <silent> <C-n> <cmd> lua vim.lsp.diagnostic.goto_prev()<CR>
369
+ nnoremap <silent> <C-p> <cmd> lua vim.lsp.diagnostic.goto_next()<CR>
358
370
359
371
360
372
" NerdTree
@@ -471,8 +483,11 @@ augroup END
471
483
472
484
473
485
474
-
475
-
486
+ " Prettier
487
+ autocmd BufWritePre *.js lua vim .lsp .buf .formatting_sync (nil, 100 )
488
+ autocmd BufWritePre *.vue lua vim .lsp .buf .formatting_sync (nil, 100 )
489
+ autocmd BufWritePre *.jsx lua vim .lsp .buf .formatting_sync (nil, 100 )
490
+ autocmd BufWritePre *.py lua vim .lsp .buf .formatting_sync (nil, 100 )
476
491
477
492
478
493
0 commit comments