From c84dfd174ae24e22ce378494db61a4fba890939f Mon Sep 17 00:00:00 2001 From: AlanDing Date: Sat, 19 Oct 2019 19:38:43 +0800 Subject: [PATCH] change lang#java mapping-gd (#3167) --- autoload/SpaceVim/layers/lang/java.vim | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim/layers/lang/java.vim b/autoload/SpaceVim/layers/lang/java.vim index 3fb788f16..d5d70c5e9 100644 --- a/autoload/SpaceVim/layers/lang/java.vim +++ b/autoload/SpaceVim/layers/lang/java.vim @@ -102,12 +102,17 @@ function! SpaceVim#layers#lang#java#config() abort call SpaceVim#mapping#space#regesit_lang_mappings('java', function('s:language_specified_mappings')) call SpaceVim#plugins#repl#reg('java', 'jshell') call add(g:spacevim_project_rooter_patterns, 'pom.xml') + + if SpaceVim#layers#lsp#check_filetype('java') + call SpaceVim#mapping#gd#add('java', function('SpaceVim#lsp#go_to_def')) + else + call SpaceVim#mapping#gd#add('java', function('s:go_to_def')) + endif augroup SpaceVim_lang_java au! if !SpaceVim#layers#lsp#check_filetype('java') " omnifunc will be used only when no java lsp support autocmd FileType java setlocal omnifunc=javacomplete#Complete - call SpaceVim#mapping#gd#add('java', function('s:go_to_def')) endif autocmd FileType jsp call JspFileTypeInit() augroup END @@ -189,6 +194,9 @@ function! s:language_specified_mappings() abort call SpaceVim#mapping#space#langSPC('nmap', ['l', 'g', 't'], \ '(JavaComplete-Generate-ToString)', \ 'Generate toString function', 0) + call SpaceVim#mapping#space#langSPC('nmap', ['l', 'g', 'n'], + \ '(JavaComplete-Generate-NewClass)', + \ 'Generate NewClass in current Package', 0) " Jump let g:_spacevim_mappings_space.l.j = {'name' : '+Jump'} @@ -240,6 +248,8 @@ function! s:language_specified_mappings() abort call SpaceVim#mapping#space#langSPC('nnoremap', ['l','g', 't'], 'call call(' \ . string(function('s:execCMD')) . ', ["gradle test"])', \ 'Run gradle test', 1) + + " REPL let g:_spacevim_mappings_space.l.s = {'name' : '+Send'} call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'i'], \ 'call SpaceVim#plugins#repl#start("java")', @@ -269,7 +279,7 @@ function! s:java_mappings() abort endfunction function! s:go_to_def() abort - call SpaceVim#lsp#go_to_def() + exe 'normal! gd' endfunction function! s:execCMD(cmd) abort