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

feat(lang#python): add g D to jump type definition

- fix `g d` lsp checking
- add `g D` for type def jumping
This commit is contained in:
Shidong Wang 2021-10-06 22:40:26 +08:00
parent 6767f4da4e
commit aa3deb1f25
No known key found for this signature in database
GPG Key ID: 41BB7053E835C848
2 changed files with 7 additions and 1 deletions

View File

@ -50,6 +50,7 @@
" Key Function
" --------------------------------
" SPC l r run current file
" g d jump to definition
" <
"
" This layer also provides REPL support for python, the key bindings are:
@ -66,6 +67,7 @@
" be used:
" >
" key binding Description
" g D jump to type definition
" SPC l e rename symbol
" SPC l x show references
" SPC l s show line diagnostics
@ -217,6 +219,7 @@ function! s:language_specified_mappings() abort
if SpaceVim#layers#lsp#check_filetype('python')
\ || SpaceVim#layers#lsp#check_server('pyright')
nnoremap <silent><buffer> K :call SpaceVim#lsp#show_doc()<CR>
nnoremap <silent><buffer> gD :<C-u>call SpaceVim#lsp#go_to_typedef()<Cr>
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'],
\ 'call SpaceVim#lsp#show_doc()', 'show-document', 1)
@ -261,7 +264,8 @@ func! s:getexe() abort
endf
function! s:go_to_def() abort
if !SpaceVim#layers#lsp#check_filetype('python')
if SpaceVim#layers#lsp#check_filetype('python')
\ || SpaceVim#layers#lsp#check_server('pyright')
call jedi#goto()
else
call SpaceVim#lsp#go_to_def()

View File

@ -3540,6 +3540,7 @@ KEY BINDINGS
Key Function
--------------------------------
SPC l r run current file
g d jump to definition
<
This layer also provides REPL support for python, the key bindings are:
@ -3556,6 +3557,7 @@ If the lsp layer is enabled for python, the following key bindings can be
used:
>
key binding Description
g D jump to type definition
SPC l e rename symbol
SPC l x show references
SPC l s show line diagnostics