是否有标准操作插入文本,可以用于键绑定? [英] Is there a standard action that inserts text, that can be used in a key binding?
问题描述
在编辑器中,我想将键序列绑定到insert character x这样的动作,其中x是一组字符之一不在每个键盘上(如§°€μöß',希腊字母等)。
如何在eclipse中执行此操作?
我需要为每个需要的字符写一个单独的命令(和或动作?)?此外,如果可能,我希望它具有可配置,当然。但是,首先是第一件事。
在像UltraEdit或jEdit这样的常规编辑器中,我将记录一个宏并绑定一个调用它的键序列。在1分钟内完成。在jEdit中,这样一个宏会产生一行bsh代码:
insertText(§);
您可以尝试Eclipse插件实践宏。它允许您记录宏,但也可以手动定义。
要创建一个在编辑器中插入§的短按钮,您必须执行以下步骤:
-
进入首选项/实用宏选项/编辑器宏定义,并创建一个新的宏。添加命令Insert String并在文本字段中键入§。然后给宏一个名字和一个id,例如testmacro。
-
转到首选项/常规/键,搜索新创建的 testmacro。您现在可以绑定任意键组合。
I am fairly new to eclipse as far as it regards programming. After reading docs and faqs the whole day, I learned that key sequences can be bound to commands, which in turn can invoke actions (or was it the other way around?). Anyway, I miss a list of "standard actions", surely, inserting a character in response to a key stroke must be standard? But I din't find it.
In an editor I want to bind key sequences to actions like "insert character x", where x is one of a set of characters not on every keyboard (like §°€µöß´, greek letters, etc.).
How do I do this in eclipse?
Do I really have to write a separate command (and or action?) for every character I need? Moreover, if possible I want it to have configurable, of course. But, first things first.
In conventional editors like UltraEdit or jEdit, I would record a macro and bind a key sequence that invokes that. It's done in 1 minute. In jEdit, such a macro results in one line of bsh code that looks like:
insertText("§");
You can try the Eclipse plugin Practically Macro. It allows you to record macros but also to define it by hand.
To create a short key that inserts "§" in your editor you must do the following steps:
Go into "Preferences/Practically Macro Options/Editor Macro Definitions" and create a new macro. Add the command "Insert String" and type § in the text field. Then give the macro a name and an id, e.g., "testmacro".
Go to "Preferences/General/Keys" and search for your newly created "testmacro". You can now bind an arbitrary key combination to it.
这篇关于是否有标准操作插入文本,可以用于键绑定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!