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

Clear langSPC on BufLeave

This commit is contained in:
wsdjeg 2017-05-09 23:01:28 +08:00
parent 84eb522f3d
commit 28f6bedcf2
3 changed files with 30 additions and 0 deletions

View File

@ -10,6 +10,7 @@
function! SpaceVim#autocmds#init() abort
augroup SpaceVim_core
au!
autocmd BufLeave * let g:_spacevim_mappings_space.l = {'name' : '+Language Specified'}
autocmd BufWinEnter quickfix nnoremap <silent> <buffer>
\ q :cclose<cr>:lclose<cr>
autocmd BufEnter * if (winnr('$') == 1 && &buftype ==# 'quickfix' ) |

View File

@ -79,6 +79,7 @@ function! SpaceVim#layers#lang#java#config() abort
nmap <silent><buffer> <leader>jM <Plug>(JavaComplete-Generate-AbstractMethods)
imap <silent><buffer> <C-j>jM <Plug>(JavaComplete-Generate-AbstractMethods)
call SpaceVim#mapping#space#langSPC('nmap', ['l','M'], '<Plug>(JavaComplete-Generate-AbstractMethods)', 'Generate abstract methods', 0)
nmap <silent><buffer> <leader>jA <Plug>(JavaComplete-Generate-Accessors)
nmap <silent><buffer> <leader>js <Plug>(JavaComplete-Generate-AccessorSetter)

View File

@ -16,6 +16,7 @@ function! SpaceVim#mapping#space#init() abort
let g:_spacevim_mappings_space.w = {'name' : '+Windows'}
let g:_spacevim_mappings_space.p = {'name' : '+Projects'}
let g:_spacevim_mappings_space.h = {'name' : '+Help'}
let g:_spacevim_mappings_space.l = {'name' : '+Language Specified'}
" Windows
let g:_spacevim_mappings_space.w['<Tab>'] = ['wincmd w', 'alternate-window']
call SpaceVim#mapping#menu('alternate-window', '[SPC]w<Tab>', 'wincmd w')
@ -110,3 +111,30 @@ function! s:windows_layout_toggle() abort
wincmd w
endif
endfunction
function! SpaceVim#mapping#space#langSPC(m, keys, cmd, desc, is_cmd) abort
if s:has_map_to_spc()
return
endif
if a:is_cmd
let cmd = ':<C-u>' . a:cmd . '<CR>'
let lcmd = a:cmd
else
let cmd = a:cmd
let feedkey_m = a:m =~# 'nore' ? 'n' : 'm'
if a:cmd =~? '^<plug>'
let lcmd = 'call feedkeys("\' . a:cmd . '", "' . feedkey_m . '")'
else
let lcmd = 'call feedkeys("' . a:cmd . '", "' . feedkey_m . '")'
endif
endif
exe a:m . ' <silent> <buffer> [SPC]' . join(a:keys, '') . ' ' . substitute(cmd, '|', '\\|', 'g')
if len(a:keys) == 2
let g:_spacevim_mappings_space[a:keys[0]][a:keys[1]] = [lcmd, a:desc]
elseif len(a:keys) == 3
let g:_spacevim_mappings_space[a:keys[0]][a:keys[1]][a:keys[2]] = [lcmd, a:desc]
elseif len(a:keys) == 1
let g:_spacevim_mappings_space[a:keys[0]] = [lcmd, a:desc]
endif
call SpaceVim#mapping#menu(a:desc, '[SPC]' . join(a:keys, ''), lcmd)
call extend(g:_spacevim_mappings_prefixs['[SPC]'], get(g:, '_spacevim_mappings_space', {}))
endfunction