How to get emacs-like keybindings in Pharo?
Asked Answered
N

2

8

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.

Niemann answered 5/8, 2016 at 11:45 Comment(0)
Y
6

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.

Yan answered 5/8, 2016 at 13:6 Comment(0)
T
3

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.

Trudge answered 24/5, 2018 at 3:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.