|
" |
|
" asyncomplete, asyncomplete-lspで自動補完もあって快適。 |
|
" 自動補完が不要ならオプションで止めるとか、そもそも入れないとか |
|
" |
|
|
|
"""""""""""""" |
|
" vim-plug " |
|
"""""""""""""" |
|
|
|
" Completion | asyncomplete & vim-lsp related {{{ |
|
Plug 'prabirshrestha/async.vim' |
|
Plug 'prabirshrestha/asyncomplete.vim' |
|
Plug 'prabirshrestha/vim-lsp' |
|
Plug 'prabirshrestha/asyncomplete-lsp.vim' |
|
" }}} |
|
|
|
"""""""""""""""""""""""""" |
|
" asyncomplete setting " |
|
"""""""""""""""""""""""""" |
|
|
|
" Force refresh completion |
|
imap <C-x><C-u> <Plug>(asyncomplete_force_refresh) |
|
|
|
""""""""""""""""""""" |
|
" vim-lsp setting " |
|
""""""""""""""""""""" |
|
|
|
" |
|
" Python |
|
" |
|
" [install] |
|
" pip3 install python-language-server |
|
" |
|
" [command] |
|
" pyls |
|
" |
|
" [misc] |
|
" python3.7の場合は下記の問題があったがわからない @2018/08/xx |
|
" |
|
" 1. python-language-serverはグローバルに入れても仮想環境に入ったら使えない |
|
" 2. 仮想環境の中で使ってみるがvenvは使えるけどpipenvは使えない |
|
" 3. 仮想環境(venv限定)でpylsをインストールすれば使える |
|
" |
|
" python3.6ならグローバルでも仮想環境内でも問題なし! |
|
" |
|
|
|
if executable('pyls') |
|
augroup LspPython |
|
au! |
|
au User lsp_setup call lsp#register_server({ |
|
\ 'name': 'pyls', |
|
\ 'cmd': {server_info->['pyls']}, |
|
\ 'whitelist': ['python'], |
|
\ }) |
|
|
|
" omnifunc |
|
autocmd FileType python setlocal omnifunc=lsp#complete |
|
" map |
|
au FileType python nnoremap <buffer><silent> gd :<C-u>LspDefinition<CR> |
|
au FileType python nnoremap <buffer><silent> gD :<C-u>LspReferences<CR> |
|
au FileType python nnoremap <buffer><silent> gs :<C-u>LspDocumentSymbol<CR> |
|
au FileType python nnoremap <buffer><silent> gS :<C-u>LspWorkspaceSymbol<CR> |
|
au FileType python nnoremap <buffer><silent> gQ :<C-u>LspDocumentFormat<CR> |
|
au FileType python vnoremap <buffer><silent> gQ :LspDocumentRangeFormat<CR> |
|
au FileType python nnoremap <buffer><silent> K :<C-u>LspHover<CR> |
|
au FileType python nnoremap <buffer><silent> <F1> :<C-u>LspImplementation<CR> |
|
au FileType python nnoremap <buffer><silent> <F2> :<C-u>LspRename<CR> |
|
augroup end |
|
endif |