自动替换在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
.