Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我在宏中使用它时,我想优化寄存器的初始化。
我通常通过做类似的事情来初始化我的寄存器q:i0 <Esc> "eyiw:q,但我认为有更好的方法......如果可能的话,我想避免进入插入模式。
q:i0 <Esc> "eyiw:q
qaq(开始并立即停止录制)清除寄存器a。
qaq
a
因此,要清除寄存器q并开始录制(例如递归宏),请使用qqqqq...
q
qqqqq...
从命令行,您还可以执行以下操作:
:let @a = ''
或者
:call setreg('a', '')