Emacs最好的代码模板工具是什么? [英] What is the best code template facility for Emacs?
问题描述
功能:
- 容易定义新的片段(纯文本,具有默认值的自定义输入)
- 片段中预定义位置之间的简单导航
- 多次插入相同的自定义输入
- 接受当前选定的文本作为自定义输入
- 跨平台(Windows,Linux) / li>
- 动态评估表达式(嵌入式代码)以简洁的编程语言编写(Perl,Python,Ruby是首选)
- 很好地与Emacs中的其他软件包共存
代码模板示例,一个简单的 for
循环在C: (int i = 0; i<%N%; ++ i){
$ $
这种常见的代码是很多打字的。我想调用一个代码模板或代码片段,插入
这个样板代码。此外,它停止(在TAB或其他击键)在%N%
(我的输入替换它),光标的最终位置是 _
。
TextMate的片段是最接近的匹配,但它不是跨平台的解决方案,而不是Emacs。
第二个最接近的是 yasnippet ( screencast 显示主要功能)。但是它干扰了我的安装程序中的 hippie-expand
包,嵌入式语言是EmacsLisp,我不太在外面 .emacs
。
编辑:发布我的答案,允许投票 yasnippet
。
Particularly, what is the best snippets package out there?
Features:
- easy to define new snippets (plain text, custom input with defaults)
- simple navigation between predefined positions in the snippet
- multiple insertion of the same custom input
- accepts currently selected text as a custom input
- cross-platform (Windows, Linux)
- dynamically evaluated expressions (embedded code) written in a concise programming language (Perl, Python, Ruby are preferred)
- nicely coexists with others packages in Emacs
Example of code template, a simple for
loop in C:
for (int i = 0; i < %N%; ++i) {
_
}
It is a lot of typing for such common code. I want to invoke a code template or snippet which inserts
that boilerplate code for me. Additionally it stops (on TAB or other keystroke) at %N%
(my input replaces it) and final position of the cursor is _
.
TextMate's snippets are the most closest match but it is not a cross-platform solution and not for Emacs.
The second closest thing is yasnippet (screencast shows main capabilities). But it interferes with hippie-expand
package in my setup and the embedded language is EmacsLisp which I'm not comfortable with outside .emacs
.
EDIT: Posted my answer here to allow voting on yasnippet
.
这篇关于Emacs最好的代码模板工具是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!