From d3238508c910c2691c5b7dc0a4b295db1d91422b Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 22 Jan 2017 21:29:29 +0800 Subject: [PATCH] Add default mappings --- autoload/SpaceVim/autocmds.vim | 1 - autoload/SpaceVim/layers/lang/java.vim | 46 +++++++++++++++++++++++++- config/functions.vim | 11 ------ 3 files changed, 45 insertions(+), 13 deletions(-) diff --git a/autoload/SpaceVim/autocmds.vim b/autoload/SpaceVim/autocmds.vim index 13baa023b..04532b7d1 100644 --- a/autoload/SpaceVim/autocmds.vim +++ b/autoload/SpaceVim/autocmds.vim @@ -9,7 +9,6 @@ function! SpaceVim#autocmds#init() abort \ q | endif autocmd FileType jsp call JspFileTypeInit() autocmd FileType html,css,jsp EmmetInstall - autocmd FileType java call JavaFileTypeInit() autocmd BufRead,BufNewFile *.pp setfiletype puppet autocmd BufEnter,WinEnter,InsertLeave * set cursorline autocmd BufLeave,WinLeave,InsertEnter * set nocursorline diff --git a/autoload/SpaceVim/layers/lang/java.vim b/autoload/SpaceVim/layers/lang/java.vim index f10123583..9ef31de8e 100644 --- a/autoload/SpaceVim/layers/lang/java.vim +++ b/autoload/SpaceVim/layers/lang/java.vim @@ -10,5 +10,49 @@ function! SpaceVim#layers#lang#java#plugins() abort endfunction function! SpaceVim#layers#lang#java#config() abort - + function! s:java_mappings() abort + inoremap UU bgUwea + inoremap uu bguwea + inoremap ua bgulea + inoremap Ua bgUlea + nmap (JavaComplete-Imports-Add) + imap (JavaComplete-Imports-Add) + nmap jI (JavaComplete-Imports-AddMissing) + nmap jR (JavaComplete-Imports-RemoveUnused) + nmap ji (JavaComplete-Imports-AddSmart) + nmap jii (JavaComplete-Imports-Add) + + imap I (JavaComplete-Imports-AddMissing) + imap R (JavaComplete-Imports-RemoveUnused) + imap i (JavaComplete-Imports-AddSmart) + imap ii (JavaComplete-Imports-Add) + + nmap jM (JavaComplete-Generate-AbstractMethods) + + imap jM (JavaComplete-Generate-AbstractMethods) + + nmap jA (JavaComplete-Generate-Accessors) + nmap js (JavaComplete-Generate-AccessorSetter) + nmap jg (JavaComplete-Generate-AccessorGetter) + nmap ja (JavaComplete-Generate-AccessorSetterGetter) + nmap jts (JavaComplete-Generate-ToString) + nmap jeq (JavaComplete-Generate-EqualsAndHashCode) + nmap jc (JavaComplete-Generate-Constructor) + nmap jcc (JavaComplete-Generate-DefaultConstructor) + + imap s (JavaComplete-Generate-AccessorSetter) + imap g (JavaComplete-Generate-AccessorGetter) + imap a (JavaComplete-Generate-AccessorSetterGetter) + + vmap js (JavaComplete-Generate-AccessorSetter) + vmap jg (JavaComplete-Generate-AccessorGetter) + vmap ja (JavaComplete-Generate-AccessorSetterGetter) + endfunction + augroup SpaceVim_lang_java + au! + autocmd FileType java setlocal omnifunc=javacomplete#Complete + autocmd FileType java call s:java_mappings() + set tags +=~/others/openjdksrc/java/tags + set tags +=~/others/openjdksrc/javax/tags + augroup END endfunction diff --git a/config/functions.vim b/config/functions.vim index f202bac35..7314bca94 100644 --- a/config/functions.vim +++ b/config/functions.vim @@ -58,17 +58,6 @@ function! XmlFileTypeInit() set dict+=~/.vim/bundle/vim-dict/dict/android_xml.dic endif endf -function! JavaFileTypeInit() - set omnifunc=javacomplete#Complete - set tags +=~/others/openjdksrc/java/tags - set tags +=~/others/openjdksrc/javax/tags - inoremap UU bgUwea - inoremap uu bguwea - inoremap ua bgulea - inoremap Ua bgUlea - nmap (JavaComplete-Imports-Add) - imap (JavaComplete-Imports-Add) -endf function! WSDAutoComplete(char) if(getline(".")=~?'^\s*.*\/\/')==0 let line = getline('.')