我需要在多个超文本标记语言文档中的一堆不同的单词周围插入<code> ...</code>。例如,如果我有这样的文本:
The clear command clears the current register然后,我希望能够将标记定位在第一个"clear“之前,执行一个快速击键,例如C-c c,并将文本更改为
The <code>clear</code> command clears the current register我不得不做很多这样的事情。
我在emacs 25中使用html-mode。
注意:我也不介意在当前区域中包装<code>...</code>的命令。
发布于 2017-01-09 22:40:01
wrap-region-mode会做你想做的事。你可以用包管理器来安装它。
Wrap Region is a minor mode for Emacs that wraps a region with punctuations. For "tagged" markup modes, such as HTML and XML, it wraps with tags.
它定义了默认的“包装器”,但是你可以添加包装器,比如你的<code>标签。
发布于 2020-11-21 02:37:54
默认情况下,至少在Emacs 27.1中,如果您打开一个html文件,就可以使用sgml-mode命令。这包括绑定到C-c C-o的命令sgml-tag。
如果选择一个区域,则执行C-c C-o,如果将提示您键入标记的名称,然后输入属性。因此,如果您为标记输入"code“,然后在没有属性的情况下按enter,那么就会做您想要的事情。
https://stackoverflow.com/questions/41545704
复制相似问题