fix(vim): fix <Tab> keybinding when try to fallback to original one. (#616)
* fix(vim): fix <Tab> keybinding when try to fallback to original one. * fix: fix typo.r0.4
parent
573196b9d9
commit
ae6e6bfe37
|
|
@ -12,8 +12,8 @@ function! tabby#keybindings#Map()
|
|||
if !empty(mapcheck('<Tab>', 'i'))
|
||||
" fallback to the original <Tab> mapping
|
||||
let tab_maparg = maparg('<Tab>', 'i', 0, 1)
|
||||
" warp as function if rhs is expr
|
||||
let fallback_rhs = tab_maparg.expr ? '{ -> ' . tab_maparg.rhs . ' }' : tab_maparg.rhs
|
||||
" warp as function if rhs is expr, otherwise encode rhs as json
|
||||
let fallback_rhs = tab_maparg.expr ? '{ -> ' . tab_maparg.rhs . ' }' : substitute(json_encode(tab_maparg.rhs), '<', '\\<', 'g')
|
||||
" inject <SID>
|
||||
let fallback_rhs = substitute(fallback_rhs, '<SID>', "\<SNR>" . get(tab_maparg, 'sid') . '_', 'g')
|
||||
exec 'imap <script><silent><nowait><expr> <Tab> tabby#Accept(' . fallback_rhs . ')'
|
||||
|
|
|
|||
Loading…
Reference in New Issue