mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 17:40:06 +08:00
Add jump transtate (#3590)
This commit is contained in:
parent
d0b07bbc78
commit
26c0a865db
@ -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
|
||||
|
@ -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! \<C-i>"| catch | endtry ',
|
||||
\ 'exit' : 0,
|
||||
\ },
|
||||
\ {
|
||||
\ 'key' : 'J',
|
||||
\ 'desc' : 'previous jump',
|
||||
\ 'func' : '',
|
||||
\ 'cmd' : 'try | exe "norm! \<c-o>" | 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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user