Is there anyway to have jEdits keyboard controls behave the same way that a native Mac OS app does?
By behave I mean command+left moves the caret to the start of the line, alt+left moves to the beginning of the current word etc.
Is there anyway to have jEdits keyboard controls behave the same way that a native Mac OS app does?
By behave I mean command+left moves the caret to the start of the line, alt+left moves to the beginning of the current word etc.
First the ALT key needs to be enabled. Do this in the startup.bsh file located in:
JEDIT_HOME/Contents/Resources/Java/startup/startup.bsh
On Mac OX this would typically be:
/Applications/jEdit.app/Contents/Resources/Java/startup/startup.bsh
The following lines should be uncommented:
Debug.ALT_KEY_PRESSED_DISABLED = false;
Debug.ALTERNATIVE_DISPATCHER = false;
You can now include the ALT key in keymappings, where
C => CMD M => ALT
Go to End of Line: C+Right Go to Start of Line: C+Left Go to Next Word: M+Right Go to Previous Word: M+Left Select Next Word: MS+Right Select Previous Word: MS+Left Select to End of Line: CS+Right Select to Start of Line: CS+Left
Unfortunately Brian's findings do not play well with QWERTZ keyboards: it disables the possibility to enter chars like pipe, curly brackets, or whatever uses the ALT-key as modifier.
According to the comments in startup.bsh:
/*{{{ Remapping modifier keys part II */
/* Note if you chose to make use of the M+ (option key) prefix on MacOS, you
* will need to disable a little piece of code: */
//Debug.ALT_KEY_PRESSED_DISABLED = false;
/* Otherwise M+ will be ignored for the purposes of keyboard shortcuts. */
/* But if you enable this, you might find that Option+8 for example invokes your
* macro but also inserts a bulletpoint, as per standard Macintosh keyboard
* behavior. To disable the Option key for inserting special high ASCII
* characters, uncomment this. Note that it has wider implications, notably
* DROVAK keyboard shortcuts will be mapped as if the keyboard was QWERTY. */
//Debug.ALTERNATIVE_DISPATCHER = false;
/*}}}*/
only uncommenting Debug.ALT_KEY_PRESSED_DISABLED
should do the trick, but here[1] it doesn't - I can either use ALT as modifier for shortcuts, or as a modifier for entering chars.. a prior section also deals with the mapping of modifiers:
/*{{{ Remapping modifier keys part I */
/* The below is the default, swap the items around to
* change meaning of C+, A+, M+, S+.
*/
//KeyEventTranslator.setModifierMapping(InputEvent.CTRL_MASK,
// InputEvent.ALT_MASK, InputEvent.META_MASK,
// InputEvent.SHIFT_MASK);
/* ... and this the MacOS default: */
//KeyEventTranslator.setModifierMapping(InputEvent.META_MASK, /* == C+ */
// InputEvent.CTRL_MASK, /* == A+ */
// InputEvent.ALT_MASK, /* == M+ */
// InputEvent.SHIFT_MASK /* == S+ */);
/*}}}*/
but whatever combination of settings I tried, I wasn't able to achieve a setup with both options (ALT as modifier for shortcuts and textinput) working.
So: any hint/fix would be highly appreciated. ;-)
[1] here means: jEdit 4.3.2 @ OSX 10.5.8 (Java 1.5.0_30) with QWERTZ (German) keyboard
A solution that works for me:
Create some macros that insert the special alt-characters you need into the textArea (one macro per character).
Then you can change the setup to enable the alt-key for jedit (I enabled only the first of the two properties).
After that you can assign alt-shortcuts for the macros you recorded in a way that the special characters will be insterted by the same shortcus as before.
After that you can change the shortcut-setup for text-navigation to match the mac-standard and you will still have the special characters available through the defined macro-shortcuts.