Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Is there a way to set the HOME and END keys on a Mac's keyboard to jump the cursor to the line's beginning and end respectively?

I tried to apply a global solution, as suggested for example here, but this didn't help. Is there a way to do it internally in mathematica?

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

The file KeyEventTranslations.tr which can be found in the directory $InstallationDirectory/SystemFiles/FrontEnd/TextResources/Macintosh couples key events to actions in Mathematica. The two lines that define the behaviour of Home and End are

Item[KeyEvent["Home"], "ScrollNotebookStart"],
Item[KeyEvent["End"], "ScrollNotebookEnd"],

To change the behaviour of these two keys you could replace "ScrollNotebookStart" and "ScrollNotebookEnd" to "MoveLineBeginning" and "MoveLineEnd", respectively.

To be on the safe side, you could copy the file to the directory $UserBaseDirectory/SystemFiles/FrontEnd/TextResources/Macintosh first and edit that file instead of the original in $InstallationDirectory.

share|improve this answer
    
Do you know where these things are documented? And one remark, under mac, the file is located in another subdirectory named "Macintosh". Thank! –  Dror Apr 10 '12 at 9:49
    
@Dror I've corrected the directory. I don't think these things are documented very well. There is some information about the various files and directories in the installation tree in the entry tutorial/MathematicaFileOrganization in the Documentation Center but that's about it AFAIK. –  Heike Apr 10 '12 at 9:59
    
Putting KeyEventTranslations.tr in $UserBaseDirectory/.../Macintosh wasn't picked up on my system. I'll continue to poke at it and see if I can figure out where I should put it, but in the meantime, if you come up with something, please post an update. –  rcollyer Apr 10 '12 at 15:16
    
@rcollyer Have you tried restarting Mathematica after making changes to KeyEventTranslations.tr? –  Heike Apr 10 '12 at 16:22
    
Absolutely. I made the change, saved, shut-down mma, and restarted. –  rcollyer Apr 10 '12 at 17:03
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.