如何保存包含“Escape"的 Vim 宏按键? [英] How to save a Vim macro that contains "Escape" key presses?

查看:20
本文介绍了如何保存包含“Escape"的 Vim 宏按键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常使用以下 Vim 宏(它将当前行放在 XML 标签中):

I use the following Vim macro a lot (it puts the current line inside XML tags):

I<e>^[A</e>

所以我把它保存到我的 .vimrc

So I saved it into my .vimrc

let @e='I<e>^[A</e>'

但它不起作用.
^[ 部分的意思是转义",但在 .vimrc

But it does not work.
The ^[ part means "Escape" but it is not understood as such in .vimrc

如何保存这个宏,或者任何包含Escape"的宏?

How can I save this macro, or any macro that contains "Escape" ?

推荐答案

尝试在插入模式下使用 进入转义符.参见 vim 中的 :help i_CTRL-V.

Try entering the escape with <Ctrl-v><Esc> in insert mode. See :help i_CTRL-V in vim.

这篇关于如何保存包含“Escape"的 Vim 宏按键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆