Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get emacs-like keybindings in Pharo?

I've downloaded Pharo today, and I noticed most keybindings don't work within the language environment. Is there any possible way to get standard Mac / Linux keybindings to work?

I could find no answer searching on Google.

I'd appreciate if someone could tell me how to configure the standard

Ctrl+a, BeginningOfLine
Ctrl+e, EndOfLine
Ctrl+d, forwardDelete
Ctrl+f, forwardChar
Ctrl+b, backwardChar
Ctrl+n, nextLine
Ctrl+p, previousLine

to work on Pharo 5.0.

like image 997
dangom Avatar asked Aug 05 '16 11:08

dangom


2 Answers

If by "standard" you mean "emacs-like keybindings" then no, Pharo does not support such scheme nor is there an easy way to change them.

You could change some of the hard-coded shortcuts in places like the PharoShortcuts and RubSmalltalkEditor class>>buildShortcutsOn: (which powers the Playground). However there are very likely more places (e.g. Nautilus).

Several of the shortcuts you mentioned are also core shortcuts for Pharo (in the sense that you can execute them pretty much anywhere you can type text), namely:

  • ctrl+p for printing the selection
  • ctrl+d for doing (executing) the selection
  • ctrl+n browsing senders of the highlighted selector

Furthermore ctrl+a is "select all" as in pretty much every text editor, and ctrl+f find.

However, there is an ongoing effort to cleanup the shortcuts and unify them into single place (PharoShortcuts), so in time such change should easily be possible.

like image 139
Peter Uhnak Avatar answered Sep 22 '22 15:09

Peter Uhnak


To get the basic emacs-style cursor navigation on my Mac, I punted with BetterTouchTool to send Pharo keys, like this:

ctrl+a --> fn + left-arrow    Beginning of line
ctrl+e --> fn + right-arrow   End of line
ctrl+p --> up-arrow           Previous line
ctrl+n --> down-arrow         Next line
ctrl+f --> right-arrow        Forward character
ctrl+b --> left arrow         Backward character
ctrl+v --> fn + down-arrow    Next page (behavior is inconsistent)
option+v --> fn + up-arrow    Previous page (also inconsistent)

It's not ideal, but a big step in the right direction. BetterTouchTool is awesomeness that any Mac power user should seriously consider anyway.

For the benefit of non-Mac users, there is no collision with Pharo core shortcut keys in this scheme, because on the Mac the Command key is used in place of Ctrl for Pharo core shortcuts.

like image 37
JamesDLevine Avatar answered Sep 23 '22 15:09

JamesDLevine