jEdit Community - Resources for users of the jEdit Text Editor
adding shortcut to a macro
Submitted by ianbd on Tuesday, 22 April, 2008 - 13:01
I have some simple macros to which I want to add consistent shortcut keys as part of the install.

I assume that I use the jEdit.setProperty option with something like:
jEdit.setProperty("my_macros/macro1.shortcut", "CA+1"); but that does not work.

When I check the global options, the shortcut is recorded as the literal string, but Ctrl + Alt + 1 does not activate the macro.

Does anyone know how to set such a shortcut? For example, is there some form of key combination code that I need to enter to get this combination to work through setProperty()?

Thanks in advance...
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
Using the "Global Options" ->
by elberry on Tue, 22/04/2008 - 22:42
Using the "Global Options" -> "Shortcuts" works for me.

I assigned a macro to Ctrl + Alt + 1, and it gets executed when I type that key combination.

What does your macro do?

Try creating a macro like this:
[code]
Macros.message(view, "Macro Executed");
[/code]

and assign that to your key combinations. It works for me.

Learn from the past. Live in the present. Plan for the future.
11101000
 
Adding shortcuts
by ianbd on Wed, 23/04/2008 - 10:04
Hey ho

I have also managed to get macros working using the jEdit menus (Global Options...), which for my personal macros is the best way.

However, the macros are used to create XML pages within a defined structure, and are to be used by multiple people. I have had a request for shortcut keys and as I don't want to tell the users to add their own shortcuts, I want to create a set of shortcuts as part of the install. This has started as a set of beanshell macros, but may end up being a plugin.

The documents I have found seem to indicate the way to script shortcuts is using the jEdit.setProprty() function, but I am struggling to make this work. If there is a different way of scripting the shortcuts that would be great, if not I am trying to find out how to make the setProperty option work.
 
property file
by Robert Schwenn on Thu, 24/04/2008 - 19:59
I don't think, that merging shortcuts definition with source code is very desirable. The pre-defined shortcuts of jedit i.e. are defined in jedit_keys.props.

All shortcuts that You assign via GlobalOptions->Shortcuts are written to Your personal "properties" file. If You want to make them available for all users You only have to do the following:
- cut the matching lines out of the "properties" file
- put them into a separate file with extension "props"
- place this file in the "properties" subdirectory of jedit's home directory (and restart jedit)

The syntax of shortcut property lines is simple. You will understand it, when You see some examples, that You defined manually.
Samples:
ActionName.shortcut=...
ActionName.shortcut2=... (for alternate shortcut)
Text/Color_Picker.shortcut=... (for macros, relative path under macros directory)

Robert
User login
Browse archives
« April 2024  
MoTuWeThFrSaSu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   82348
Context Free Art (*.cfdg)   0.31   46055
JBuilder scheme   .001   18495
BBEdit scheme   1.0   18116
ColdFusion scheme   1.0   18024
R Edit Mode - extensive version   0.1   17473
Advanced HTML edit mode   1.0   16206
Matlab Edit Mode   1.0   16068
jEdit XP icons   1.0   15229
XP icons for jEdit   1.1   14293