diff --git a/autoload/SpaceVim/api/vim/compatible.vim b/autoload/SpaceVim/api/vim/compatible.vim index 9eb33fd4c..2fd6f342f 100644 --- a/autoload/SpaceVim/api/vim/compatible.vim +++ b/autoload/SpaceVim/api/vim/compatible.vim @@ -302,6 +302,13 @@ if exists('*getjumplist') return getjumplist() endfunction else + " + " the following entries: + " bufnr buffer number + " col column number + " coladd column offset for 'virtualedit' + " filename filename if available + " lnum line number function! s:self.getjumplist() abort let jumpinfo = split(self.execute(':jumps'), "\n")[1:-2] let result = [] @@ -312,6 +319,7 @@ else \ 'bufnr' : jump, \ 'lnum' : line, \ 'col' : col, + \ 'coladd' : 0, \ }) endfor return result diff --git a/autoload/SpaceVim/layers/core.vim b/autoload/SpaceVim/layers/core.vim index 12b765ffa..abde90325 100644 --- a/autoload/SpaceVim/layers/core.vim +++ b/autoload/SpaceVim/layers/core.vim @@ -134,6 +134,9 @@ function! SpaceVim#layers#core#config() abort call SpaceVim#mapping#space#def('nnoremap', ['j', 's'], 'call call(' \ . string(s:_function('s:split_string')) . ', [0])', \ 'split-sexp', 1) + call SpaceVim#mapping#space#def('nnoremap', ['j', '.'], 'call call(' + \ . string(s:_function('s:jump_transient_state')) . ', [])', + \ 'jump-transient-state', 1) call SpaceVim#mapping#space#def('nnoremap', ['j', 'S'], 'call call(' \ . string(s:_function('s:split_string')) . ', [1])', \ 'split-and-add-newline', 1) @@ -792,6 +795,55 @@ function! s:restart_neovim_qt() abort call system('taskkill /f /t /im nvim.exe') endfunction +function! s:jump_transient_state() abort + let state = SpaceVim#api#import('transient_state') + call state.set_title('Jump Transient State') + call state.defind_keys( + \ { + \ 'layout' : 'vertical split', + \ 'left' : [ + \ { + \ 'key' : 'j', + \ 'desc' : 'next jump', + \ 'func' : '', + \ 'cmd' : 'try | exe "norm! \"| catch | endtry ', + \ 'exit' : 0, + \ }, + \ { + \ 'key' : 'J', + \ 'desc' : 'previous jump', + \ 'func' : '', + \ 'cmd' : 'try | exe "norm! \" | catch | endtry', + \ 'exit' : 0, + \ }, + \ ], + \ 'right' : [ + \ { + \ 'key' : 'c', + \ 'desc' : 'next change', + \ 'func' : '', + \ 'cmd' : "try | exe 'norm! g,' | catch | endtry", + \ 'exit' : 0, + \ }, + \ { + \ 'key' : 'C', + \ 'desc' : 'previous change', + \ 'func' : '', + \ 'cmd' : "try | exe 'norm! g;' | catch | endtry", + \ 'exit' : 0, + \ }, + \ { + \ 'key' : 'q', + \ 'desc' : 'quit', + \ 'func' : '', + \ 'cmd' : '', + \ 'exit' : 1, + \ }, + \ ], + \ } + \ ) + call state.open() +endfunction let g:_spacevim_autoclose_filetree = 1 function! s:explore_current_dir(cur) abort diff --git a/autoload/SpaceVim/mapping/guide.vim b/autoload/SpaceVim/mapping/guide.vim index b853b7087..398a26a2f 100644 --- a/autoload/SpaceVim/mapping/guide.vim +++ b/autoload/SpaceVim/mapping/guide.vim @@ -482,7 +482,12 @@ function! s:wait_for_input() abort " {{{ doautocmd WinEnter let keys = get(s:, 'prefix_key_inp', '') let name = SpaceVim#mapping#leader#getName(s:prefix_key) - call s:build_mpt(['key bindings is not defined: ', name . '-' . join(s:STR.string2chars(keys), '-') . '-' . inp]) + let _keys = join(s:STR.string2chars(keys), '-') + if empty(_keys) + call s:build_mpt(['key bindings is not defined: ', name . '-' . inp]) + else + call s:build_mpt(['key bindings is not defined: ', name . '-' . _keys . '-' . inp]) + endif let s:prefix_key_inp = '' let s:guide_help_mode = 0 endif