diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index 1e1b8cbdf..06a8f7ab4 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -469,7 +469,7 @@ function! SpaceVim#end() abort endif let g:leaderGuide_max_size = 15 let g:leaderGuide_submode_mappings = - \ { '': 'win_close', '': 'page_down', '': 'page_up'} + \ { '': 'win_close', '': 'page_down', '': 'page_up', 'u' : 'undo'} call SpaceVim#plugins#load() endfunction diff --git a/autoload/SpaceVim/mapping/guide.vim b/autoload/SpaceVim/mapping/guide.vim index c73b57cb0..af59ac76a 100644 --- a/autoload/SpaceVim/mapping/guide.vim +++ b/autoload/SpaceVim/mapping/guide.vim @@ -292,7 +292,7 @@ function! s:create_string(layout) " {{{ call insert(r, '') let output = join(r, "\n ") cnoremap - cnoremap submode + cnoremap paging_help return output endfunction " }}} @@ -328,7 +328,6 @@ function! s:handle_input(input) " {{{ if type(a:input) ==? type({}) let s:lmap = a:input let s:guide_group = a:input - let g:guide_group = a:input call s:start_buffer() else let s:prefix_key_inp = '' @@ -347,7 +346,7 @@ function! s:wait_for_input() " {{{ if inp ==? '' let s:prefix_key_inp = '' call s:winclose() - elseif match(inp, "^submode") == 0 + elseif match(inp, "^paging_help") == 0 call s:submode_mappings() else if inp == ' ' @@ -407,6 +406,12 @@ function! s:updateStatusline() abort \ SpaceVim#mapping#leader#getName(s:prefix_key) \ . get(s:, 'prefix_key_inp', '') . gname \ . '%#LeaderGuiderSep2#%#LeaderGuiderFill#' + \ . s:guide_help_msg() +endfunction + +function! s:guide_help_msg() abort + let msg = '[C-h\ paging/help]' + return msg endfunction function! s:winclose() " {{{ @@ -426,6 +431,12 @@ function! s:page_down() " {{{ redraw! call s:wait_for_input() endfunction " }}} +function! s:page_undo() " {{{ + call feedkeys("\", "n") + redraw! + let s:lmap = s:lmap_undo + call s:start_buffer() +endfunction " }}} function! s:page_up() " {{{ call feedkeys("\", "n") call feedkeys("\", "x") @@ -438,6 +449,8 @@ function! s:handle_submode_mapping(cmd) " {{{ call s:page_down() elseif a:cmd ==? 'page_up' call s:page_up() + elseif a:cmd ==? 'undo' + call s:page_undo() elseif a:cmd ==? 'win_close' call s:winclose() endif @@ -504,6 +517,7 @@ function! SpaceVim#mapping#guide#start_by_prefix(vis, key) " {{{ let rundict = s:cached_dicts[a:key] endif let s:lmap = rundict + let s:lmap_undo = rundict call s:start_buffer() endfunction " }}}