From 781fa2c2593c401c8ec857551acbd132caf9fda1 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 24 Dec 2017 19:49:52 +0800 Subject: [PATCH] Add lsp support for python --- autoload/SpaceVim/layers/lang/python.vim | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/autoload/SpaceVim/layers/lang/python.vim b/autoload/SpaceVim/layers/lang/python.vim index 30878b77a..8737ed37d 100644 --- a/autoload/SpaceVim/layers/lang/python.vim +++ b/autoload/SpaceVim/layers/lang/python.vim @@ -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 K :call SpaceVim#lsp#show_doc() + + 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