From 11e272b482d21c15f5df97843ce9f2843a3dc9a2 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 14 Mar 2017 08:12:55 +0800 Subject: [PATCH] Fix airline setting --- autoload/SpaceVim/mapping.vim | 15 ++++++++++----- config/plugins/vim-airline.vim | 4 +--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/autoload/SpaceVim/mapping.vim b/autoload/SpaceVim/mapping.vim index 65b6241cd..433ac7ca4 100644 --- a/autoload/SpaceVim/mapping.vim +++ b/autoload/SpaceVim/mapping.vim @@ -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 ', 'gf', ':call zvim#gf()', '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 =~? '^' + 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 =~? '^' - 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 diff --git a/config/plugins/vim-airline.vim b/config/plugins/vim-airline.vim index bfa69659c..5b3e4024f 100644 --- a/config/plugins/vim-airline.vim +++ b/config/plugins/vim-airline.vim @@ -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 1 AirlineSelectTab1 +call SpaceVim#mapping#def('nmap', '1', 'AirlineSelectTab1', 'Switch to airline tab 1', '', 'window 1') nmap 2 AirlineSelectTab2 nmap 3 AirlineSelectTab3 nmap 4 AirlineSelectTab4 @@ -49,7 +49,6 @@ nmap 8 AirlineSelectTab8 nmap 9 AirlineSelectTab9 nmap - AirlineSelectPrevTab nmap + 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')