jEdit Community - Resources for users of the jEdit Text Editor
Import/Export keyboard shortcuts
Submitted by takeshin on Thursday, 19 June, 2008 - 11:23
jEdit is great, but configuration/customization takes a lot of time…

It would be great feature to Import/Export keyboard shortcut list to file.
If a macro is attached to shortcut, macro file should be also exported/imported.

How to write a macro to do that?

--
takeshin
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
properties
by Robert Schwenn on Thu, 19/06/2008 - 22:44
All shortcuts that You assign via GlobalOptions->Shortcuts are written to Your personal "properties" file. If You want to separate them (and make them available for all users) You 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)

Well, this is the manual way. But maybe it's sufficient. If You want to write a macro anyway, a look at the macro \misc\Display_Shortcuts.bsh could help...

Robert
 
Re: properties
by takeshin on Fri, 20/06/2008 - 11:21
Thanks, that’s helpful. I missed the file with no extension Smiling

Do you know how if there are any methods to set shortcuts via macro?
How to determine if a shortcut is assignes to a macro or a command?

--
takeshin
 
set shortcuts via macro
by Robert Schwenn on Fri, 20/06/2008 - 21:47
Here is a demo macro to set and delete shortcuts. But I can't tell You how to determine if a shortcut is already assigned. I guess You'd have to get and process an ActionMap or InputMap...

Robert


// demo macro: set and delete shortcuts
MacroRelativePath = "Text/Color_Picker";
ActionName = "vfs.browser";

// property names for shortcuts
MacroShortcutProperty = MacroRelativePath + ".shortcut";
ActionShortcutProperty = ActionName + ".shortcut";

// get current shortcuts
OldShortcutMacro = jEdit.getProperty(MacroShortcutProperty);
OldShortcutAction = jEdit.getProperty(ActionShortcutProperty);
Macros.message(view, " macro = " + OldShortcutMacro + "\n action = " + OldShortcutAction);

// set new shortcuts
jEdit.setTemporaryProperty(ActionShortcutProperty, "A+F11"); // set new temporary shortcut (for this session only)
jEdit.setProperty(MacroShortcutProperty, "S+F11"); // set new persistent shortcut (is written to properties file)

// delete a shortcut
//jEdit.unsetProperty(MacroShortcutProperty);

// tell jEdit to apply the changed properties immediately.
jEdit.propertiesChanged();
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