自动替换在emacs中键入的某些文本字符串 [英] Automatically replace certain text string as they are typed in emacs

查看:189
本文介绍了自动替换在emacs中键入的某些文本字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一小段细微的差异让我有一段时间,我经常输入 #inclued 而不是 #include 。如果不明显,我编程了很多C和C ++。这种错字已经破坏了无数的构建和消耗时间,这将更好地用于喝咖啡或冲浪stackoverflow。当然,当我键入(在 cc-mode 当然)时,emacs可以是有帮助的,纠正我的错误。但是如何?

There's a small nuance that's been bugging me for a while, namely that I frequently type #inclued instead of #include. If it wasn't obvious, I program a lot of C and C++. That typo has wrecked countless builds and consumed time that would have been better spent drinking coffee or surfing stackoverflow. Surely emacs can be helpful and rectify my mistakes as I type (in cc-mode only, of course). But how?

搜索和搜索stackoverflow没有提供任何答案。

Googling and searching stackoverflow didn't provide any answers.

推荐答案

您可以在缩写模式中使用此功能:输入#inclued后,请执行 Cx aig包括RET ,从此,每次输入#inclued时,它将自动更改为#include。如果您想要缩写为本地模式,请使用 C-x a i l 而不是 C-x a i g 。另外,您可以使用 M-x edit-abbrevvs 编辑您的缩写。

You could use this in abbrev-mode: After you entered #inclued, do C-x a i g include RET, and from then on, every time you type #inclued, it will be changed to #include automatically. If you want that abbrev to be local to a mode, use C-x a i l instead of C-x a i g. Also, you can edit your abbrevs with M-x edit-abbrevs.

这篇关于自动替换在emacs中键入的某些文本字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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