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

Add windows mapping

This commit is contained in:
wsdjeg 2017-04-17 21:07:39 +08:00
parent 75cffccad6
commit a381ad8cc2
2 changed files with 32 additions and 0 deletions

View File

@ -6,3 +6,24 @@ function! SpaceVim#mapping#space#init() abort
nnoremap <silent> [SPC]tn :<C-u>set nu!<CR>
let g:_spacevim_mappings_space.t.n = ['set nu!', 'toggle line number']
endfunction
function! SpaceVim#mapping#space#def(m, keys, cmd, desc, is_cmd) abort
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> [SPC]' . join(a:keys) . ' ' . cmd
if len(a:keys) == 2
let g:_spacevim_mappings_space[a:keys[0]][a:keys[1]] = [lcmd, a:desc]
elseif len(a:keys) == 1
let g:_spacevim_mappings_space[a:keys[0]] = [lcmd, a:desc]
endif
endfunction

View File

@ -49,6 +49,17 @@ call SpaceVim#mapping#def('nmap', '<leader>8', '<Plug>AirlineSelectTab8', 'Switc
call SpaceVim#mapping#def('nmap', '<leader>9', '<Plug>AirlineSelectTab9', 'Switch to airline tab 9', '', 'window 9')
call SpaceVim#mapping#def('nmap', '<leader>-', '<Plug>AirlineSelectPrevTab', 'Switch to previous airline tag', '', 'window previous')
call SpaceVim#mapping#def('nmap', '<leader>+', '<Plug>AirlineSelectNextTab', 'Switch to next airline tag', '', 'window next')
call SpaceVim#mapping#space#def('nmap', [1], '<Plug>AirlineSelectTab1', 'window 1', 0)
call SpaceVim#mapping#space#def('nmap', [2], '<Plug>AirlineSelectTab2', 'window 2', 0)
call SpaceVim#mapping#space#def('nmap', [3], '<Plug>AirlineSelectTab3', 'window 3', 0)
call SpaceVim#mapping#space#def('nmap', [4], '<Plug>AirlineSelectTab4', 'window 4', 0)
call SpaceVim#mapping#space#def('nmap', [5], '<Plug>AirlineSelectTab5', 'window 5', 0)
call SpaceVim#mapping#space#def('nmap', [6], '<Plug>AirlineSelectTab6', 'window 6', 0)
call SpaceVim#mapping#space#def('nmap', [7], '<Plug>AirlineSelectTab7', 'window 7', 0)
call SpaceVim#mapping#space#def('nmap', [8], '<Plug>AirlineSelectTab8', 'window 8', 0)
call SpaceVim#mapping#space#def('nmap', [9], '<Plug>AirlineSelectTab9', 'window 9', 0)
call SpaceVim#mapping#space#def('nmap', ['-'], '<Plug>AirlineSelectPrevTab', 'window previous', 0)
call SpaceVim#mapping#space#def('nmap', ['+'], '<Plug>AirlineSelectNextTab', 'window next', 0)
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif