1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 09:20:04 +08:00

Add lsp support for python

This commit is contained in:
wsdjeg 2017-12-24 19:49:52 +08:00
parent 18cf0d996d
commit 781fa2c259

View File

@ -10,11 +10,13 @@
function! SpaceVim#layers#lang#python#plugins() abort
let plugins = []
" python
if has('nvim')
call add(plugins, ['zchee/deoplete-jedi', { 'on_ft' : 'python'}])
else
call add(plugins, ['davidhalter/jedi-vim', { 'on_ft' : 'python',
\ 'if' : has('python') || has('python3')}])
if !SpaceVim#layers#lsp#check_filetype('python')
if has('nvim')
call add(plugins, ['zchee/deoplete-jedi', { 'on_ft' : 'python'}])
else
call add(plugins, ['davidhalter/jedi-vim', { 'on_ft' : 'python',
\ 'if' : has('python') || has('python3')}])
endif
endif
call add(plugins, ['Vimjas/vim-python-pep8-indent',
\ { 'on_ft' : 'python'}])
@ -62,4 +64,12 @@ function! s:language_specified_mappings() abort
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 's'],
\ 'call SpaceVim#plugins#repl#send("selection")',
\ 'send selection and keep code buffer focused', 1)
if SpaceVim#layers#lsp#check_filetype('python')
nnoremap <silent><buffer> K :call SpaceVim#lsp#show_doc()<CR>
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'],
\ 'call SpaceVim#lsp#show_doc()', 'show_document', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'e'],
\ 'call SpaceVim#lsp#rename()', 'rename symbol', 1)
endif
endfunction