vim 中的多个二合字母
您可能知道,可以使用二合字母在 vim 中输入某些特定字符(例如,在输入模式下 Ctrl+K Rg 会生成 ®)。
有没有办法定义热键,进入允许我输入多个二合字母的模式?例如,写“sayonara”而不是“Ctrl+K sa Ctrl+K yo Ctrl+K na Ctrl+K ra”即可得到“さよなら”。
As you probably know, there is ability to enter some specific characters in vim using digraphs (In input mode Ctrl+K Rg produces ® for example).
Is there a way, to define hotkey, to enter the mode which allows me to input multiple digraphs? For example, to write "sayonara" instead of "Ctrl+K sa Ctrl+K yo Ctrl+K na Ctrl+K ra" to get "さよなら".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道。不过您可以想象一下:
nr2char(11) 是一个 CTRL-K 字符。
如果您想要为此进行映射(例如,在可视模式下,在选择上按 F1 对其进行转换;仅在单行字符选择上使用此选项):
可能有更合适的方法来做到这一点(无需擦除默认的内容)注册)但今天我太懒了。我怀疑一些 Stackers 可能想用更清晰的代码发布另一个答案,他们会得到我的支持。
Not that I know. However you can imagine this:
nr2char(11) is a CTRL-K character.
If you want a mapping for that (for example in visual mode hit F1 over the selection to transform it; use this on one-line characterwise selection only):
There might be more proper ways to do that (without erasing the contents of the default register) but I will be too lazy for today. I suspect some Stackers might want to post another answer with cleaner code, they'll get my upvote.
这是一个老问题,但给出的答案似乎不必要地复杂。
iab sayonara さよなら
在你的
.vimrc
中意味着每次你输入sayonara
你都会得到さよなら
看< code>:help abbreviations -
iab
是“插入缩写”,我广泛使用它来表示错误拼写、二合字母替换等This is an old question but the given answer seems unnecessarily complex.
iab sayonara さよなら
In your
.vimrc
will mean that every time you typesayonara
you'll getさよなら
See
:help abbreviations
-iab
is 'insert abbreviation' which I use extensively for bad spellings, digraph substitution etc.