【发布时间】:2018-09-02 14:14:18
【问题描述】:
我正在使用Commentary。它定义了以下键绑定:
command! -range -bar Commentary call s:go(<line1>,<line2>)
xnoremap <expr> <Plug>Commentary <SID>go()
nnoremap <expr> <Plug>Commentary <SID>go()
nnoremap <expr> <Plug>CommentaryLine <SID>go() . '_'
onoremap <silent> <Plug>Commentary :<C-U>call <SID>textobject(get(v:, 'operator', '') ==# 'c')<CR>
nnoremap <silent> <Plug>ChangeCommentary c:<C-U>call <SID>textobject(1)<CR>
nmap <silent> <Plug>CommentaryUndo :echoerr "Change your <Plug>CommentaryUndo map to <Plug>Commentary<Plug>Commentary"<CR>
if !hasmapto('<Plug>Commentary') || maparg('gc','n') ==# ''
xmap gc <Plug>Commentary
nmap gc <Plug>Commentary
omap gc <Plug>Commentary
nmap gcc <Plug>CommentaryLine " <-------------------- I WANT TO REBIND THIS
if maparg('c','n') ==# '' && !exists('v:operator')
nmap cgc <Plug>ChangeCommentary
endif
nmap gcu <Plug>Commentary<Plug>Commentary
endif
为了让我的一些肌肉记忆在 Vim 和 Emacs 之间保持兼容,我想将 gcc 映射到 M-;,因为那是我的 Emacs 注释切换绑定。但我不知道该怎么做,因为CommentaryLine 没有暴露。这意味着我不能用“minibuffer”中的: 调用它(Vim 中的名称?)。
如何映射这些只能通过预定义的键绑定访问的未公开功能?
【问题讨论】:
标签: vim plugins key-bindings