您可以在vim中进行交互式宏或录制吗? [英] Can you do interactive macros or recordings in vim?
问题描述
我想定义一个vim宏,该宏在特定时间会中断供用户输入,这可能吗?
I would like to define a vim macro that breaks for user input at certain times, is this possible?
显示出录音(q),而不是宏
Turns out I ment recordings (q), not macros
可以在录音中使用输入命令,但是麻烦多于其应有的价值.
It is possible to use the input command in a recording, but it's more trouble than it's worth.
我首先将插入输入转义映射到键
I first mapped insert input escape to a key
:map <F2> a<C-R>=input('input: ')<CR>
然后我在q寄存器中录制了该记录
then I made this recording in the q register
name:
并将其粘贴到新标签页
iname: ^[
最后一次转义后,我按下<C-V><F2>
进行了确认:
And after the final escape I pressed <C-V><F2>
making the line:
iname ^[^[OQ
我拉回q缓冲区,然后使用了宏,让我使用了输入功能. 它有效,但是非常糟糕.
That I yanked back to the q buffer then used the macro, letting me use the input function. It works, but terribly.
推荐答案
是.参见功能input({prompt}, [, {text} [, {completion}] ])
.甚至有
inputdialog({prompt} [, {text} [, {cancelreturn}]])
,用于弹出对话框.
Yes. See the function input({prompt}, [, {text} [, {completion}] ])
. There is even
inputdialog({prompt} [, {text} [, {cancelreturn}]])
, for a dialog popup.
这篇关于您可以在vim中进行交互式宏或录制吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!