1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 10:20:05 +08:00

Add default mappings

This commit is contained in:
wsdjeg 2017-01-22 21:29:29 +08:00
parent 7cbdfd9ca8
commit d3238508c9
3 changed files with 45 additions and 13 deletions

View File

@ -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

View File

@ -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 <silent> <buffer> <leader>UU <esc>bgUwea
inoremap <silent> <buffer> <leader>uu <esc>bguwea
inoremap <silent> <buffer> <leader>ua <esc>bgulea
inoremap <silent> <buffer> <leader>Ua <esc>bgUlea
nmap <silent><buffer> <F4> <Plug>(JavaComplete-Imports-Add)
imap <silent><buffer> <F4> <Plug>(JavaComplete-Imports-Add)
nmap <silent><buffer> <leader>jI <Plug>(JavaComplete-Imports-AddMissing)
nmap <silent><buffer> <leader>jR <Plug>(JavaComplete-Imports-RemoveUnused)
nmap <silent><buffer> <leader>ji <Plug>(JavaComplete-Imports-AddSmart)
nmap <silent><buffer> <leader>jii <Plug>(JavaComplete-Imports-Add)
imap <silent><buffer> <C-j>I <Plug>(JavaComplete-Imports-AddMissing)
imap <silent><buffer> <C-j>R <Plug>(JavaComplete-Imports-RemoveUnused)
imap <silent><buffer> <C-j>i <Plug>(JavaComplete-Imports-AddSmart)
imap <silent><buffer> <C-j>ii <Plug>(JavaComplete-Imports-Add)
nmap <silent><buffer> <leader>jM <Plug>(JavaComplete-Generate-AbstractMethods)
imap <silent><buffer> <C-j>jM <Plug>(JavaComplete-Generate-AbstractMethods)
nmap <silent><buffer> <leader>jA <Plug>(JavaComplete-Generate-Accessors)
nmap <silent><buffer> <leader>js <Plug>(JavaComplete-Generate-AccessorSetter)
nmap <silent><buffer> <leader>jg <Plug>(JavaComplete-Generate-AccessorGetter)
nmap <silent><buffer> <leader>ja <Plug>(JavaComplete-Generate-AccessorSetterGetter)
nmap <silent><buffer> <leader>jts <Plug>(JavaComplete-Generate-ToString)
nmap <silent><buffer> <leader>jeq <Plug>(JavaComplete-Generate-EqualsAndHashCode)
nmap <silent><buffer> <leader>jc <Plug>(JavaComplete-Generate-Constructor)
nmap <silent><buffer> <leader>jcc <Plug>(JavaComplete-Generate-DefaultConstructor)
imap <silent><buffer> <C-j>s <Plug>(JavaComplete-Generate-AccessorSetter)
imap <silent><buffer> <C-j>g <Plug>(JavaComplete-Generate-AccessorGetter)
imap <silent><buffer> <C-j>a <Plug>(JavaComplete-Generate-AccessorSetterGetter)
vmap <silent><buffer> <leader>js <Plug>(JavaComplete-Generate-AccessorSetter)
vmap <silent><buffer> <leader>jg <Plug>(JavaComplete-Generate-AccessorGetter)
vmap <silent><buffer> <leader>ja <Plug>(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

View File

@ -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 <silent> <buffer> <leader>UU <esc>bgUwea
inoremap <silent> <buffer> <leader>uu <esc>bguwea
inoremap <silent> <buffer> <leader>ua <esc>bgulea
inoremap <silent> <buffer> <leader>Ua <esc>bgUlea
nmap <silent><buffer> <F4> <Plug>(JavaComplete-Imports-Add)
imap <silent><buffer> <F4> <Plug>(JavaComplete-Imports-Add)
endf
function! WSDAutoComplete(char)
if(getline(".")=~?'^\s*.*\/\/')==0
let line = getline('.')