mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 05:30:05 +08:00
Support list in transient keys
This commit is contained in:
parent
26a87d2fcc
commit
45149ba8b0
@ -94,22 +94,42 @@ function! s:self._update_content() abort
|
|||||||
let right = get(self._keys.right, i)
|
let right = get(self._keys.right, i)
|
||||||
let line = ''
|
let line = ''
|
||||||
if !empty(left)
|
if !empty(left)
|
||||||
let line .= '[' . left.key . '] ' . left.desc
|
if type(left.key) ==# type('')
|
||||||
call self.highlight_keys(left.exit, i + 2, 1, 1 + len(left.key))
|
let line .= '[' . left.key . '] ' . left.desc
|
||||||
if !empty(left.cmd)
|
call self.highlight_keys(left.exit, i + 2, 1, 1 + len(left.key))
|
||||||
call extend(self._handle_inputs, {left.key : left.cmd})
|
if !empty(left.cmd)
|
||||||
elseif !empty(left.func)
|
call extend(self._handle_inputs, {left.key : left.cmd})
|
||||||
call extend(self._handle_inputs, {left.key : left.func})
|
elseif !empty(left.func)
|
||||||
|
call extend(self._handle_inputs, {left.key : left.func})
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
let line .= repeat(' ', 40 - len(line))
|
let line .= repeat(' ', 40 - len(line))
|
||||||
if !empty(right)
|
if !empty(right)
|
||||||
let line .= '[' . right.key . '] ' . right.desc
|
if type(right.key) == 1
|
||||||
call self.highlight_keys(right.exit, i + 2, 41, 41 + len(right.key))
|
let line .= '[' . right.key . '] ' . right.desc
|
||||||
if !empty(right.cmd)
|
call self.highlight_keys(right.exit, i + 2, 41, 41 + len(right.key))
|
||||||
call extend(self._handle_inputs, {right.key : right.cmd})
|
if !empty(right.cmd)
|
||||||
elseif !empty(right.func)
|
call extend(self._handle_inputs, {right.key : right.cmd})
|
||||||
call extend(self._handle_inputs, {right.key : right.func})
|
elseif !empty(right.func)
|
||||||
|
call extend(self._handle_inputs, {right.key : right.func})
|
||||||
|
endif
|
||||||
|
elseif type(right.key) == 3
|
||||||
|
let line .= '[' . join(right.key, '/') . '] ' . right.desc
|
||||||
|
let begin = 41
|
||||||
|
for key in right.key
|
||||||
|
call self.highlight_keys(right.exit, i + 2, begin, begin + len(key))
|
||||||
|
let begin = begin + len(key) + 1
|
||||||
|
endfor
|
||||||
|
if !empty(right.cmd)
|
||||||
|
for key in right.key
|
||||||
|
call extend(self._handle_inputs, {key : right.cmd})
|
||||||
|
endfor
|
||||||
|
elseif !empty(right.func)
|
||||||
|
for key in right.key
|
||||||
|
call extend(self._handle_inputs, {key : right.func})
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
call append(line('$'), line)
|
call append(line('$'), line)
|
||||||
|
@ -313,6 +313,13 @@ function! s:buffer_transient_state() abort
|
|||||||
\ 'exit' : 0,
|
\ 'exit' : 0,
|
||||||
\ },
|
\ },
|
||||||
\ {
|
\ {
|
||||||
|
\ 'key' : ['N', 'p'],
|
||||||
|
\ 'desc' : 'previous buffer',
|
||||||
|
\ 'func' : '',
|
||||||
|
\ 'cmd' : 'bp',
|
||||||
|
\ 'exit' : 0,
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
\ 'key' : 'd',
|
\ 'key' : 'd',
|
||||||
\ 'desc' : 'kill buffer',
|
\ 'desc' : 'kill buffer',
|
||||||
\ 'func' : '',
|
\ 'func' : '',
|
||||||
|
Loading…
Reference in New Issue
Block a user