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

Fix airline setting

This commit is contained in:
wsdjeg 2017-03-14 08:12:55 +08:00
parent e2a10e9e7c
commit 11e272b482
2 changed files with 11 additions and 8 deletions

View File

@ -16,14 +16,19 @@ function! SpaceVim#mapping#_def(type,key,value,desc,...) abort
call add(g:unite_source_menu_menus.CustomKeyMaps.command_candidates, [description,cmd])
endfunction
" a:1 desc
" a:2 cmd
" a:3 guide
" a:1 unite desc
" a:2 unite cmd
" a:3 guide desc
" example call SpaceVim#mapping#def('nnoremap <silent>', 'gf', ':call zvim#gf()<CR>', 'Jump to a file under cursor', '')
function! SpaceVim#mapping#def(type, key, value, ...) abort
let map = split(a:type)[0]
let lhs = a:key
let rhs = a:value
let gexe = a:value
if a:value =~? '^<plug>'
let gexe = '\' . a:value
else
endif
exec a:type . ' ' . a:key . ' ' . a:value
if a:0 > 0
let desc = a:1
@ -36,12 +41,12 @@ function! SpaceVim#mapping#def(type, key, value, ...) abort
if a:0 == 3
" enable guide
if a:key =~? '^<leader>'
let group = a:key[8:8]
let group = get(g:, 'mapleader', '\')
if !has_key(g:_spacevim_mappings, group)
let g:_spacevim_mappings[group] = {'name': 'new group'}
endif
call extend(g:_spacevim_mappings[group], {
\ a:key[9:] : ['', a:3]
\ a:key[8:] : ['call feedkeys(' . gexe . ')', a:3]
\ })
endif
endif

View File

@ -38,7 +38,7 @@ let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline#extensions#tabline#fnamecollapse = 1
let g:airline#extensions#tabline#fnametruncate = 0
"let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
nmap <leader>1 <Plug>AirlineSelectTab1
call SpaceVim#mapping#def('nmap', '<leader>1', '<Plug>AirlineSelectTab1', 'Switch to airline tab 1', '', 'window 1')
nmap <leader>2 <Plug>AirlineSelectTab2
nmap <leader>3 <Plug>AirlineSelectTab3
nmap <leader>4 <Plug>AirlineSelectTab4
@ -49,7 +49,6 @@ nmap <leader>8 <Plug>AirlineSelectTab8
nmap <leader>9 <Plug>AirlineSelectTab9
nmap <leader>- <Plug>AirlineSelectPrevTab
nmap <leader>+ <Plug>AirlineSelectNextTab
let g:_spacevim_mappings.1 = ['', 'window 1']
let g:_spacevim_mappings.2 = ['', 'window 2']
let g:_spacevim_mappings.3 = ['', 'window 3']
let g:_spacevim_mappings.4 = ['', 'window 4']
@ -58,7 +57,6 @@ let g:_spacevim_mappings.6 = ['', 'window 6']
let g:_spacevim_mappings.7 = ['', 'window 7']
let g:_spacevim_mappings.8 = ['', 'window 8']
let g:_spacevim_mappings.9 = ['', 'window 9']
let g:_spacevim_mappings.1 = ['', 'window 1']
let g:_spacevim_mappings['-'] = ['', 'previous window']
let g:_spacevim_mappings['+'] = ['', 'next window']
if !exists('g:airline_symbols')