Skip to content

Instantly share code, notes, and snippets.

@peteruhnak
Last active April 5, 2019 22:36
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save peteruhnak/d9ee54f67d88b20ba85618e189b15669 to your computer and use it in GitHub Desktop.
Save peteruhnak/d9ee54f67d88b20ba85618e189b15669 to your computer and use it in GitHub Desktop.
Pharo Nautilus Shortcuts Cheatsheet

Nautilus Shortcuts Cheatsheet

All shortcut keys are with the Meta key, e.g. F P = Meta+F Meta+P.

Meta key depends on your platform (Ctrl for Linux, Alt for Windows).

Running shortcuts from code editor

Unfortunately when you are in the source code editor, the editor will consume most of the shortcuts which is annoying as **** (some, such as running tests seems to always work though).

You can "fix" this by clicking on a class/method/protocol pane (to remove the focus from the code editor), or press Meta+Tab six times to switch focus to the package pane. This makes use of the shortcuts much more annoying, but still worth it in most of the cases. Meta+Tab no longer works in Pharo 6.

Workaround:

compile the following method to a class-side of any class; then ctrl+shift+t should give the focus back to Nautilus. You can also add it as a startup action.

buildRemoveFocusShortcutsOn: aBuilder
    <keymap>
    (aBuilder shortcut: #removeKeyboardFocus)
        category: RubTextEditor name
        default: $t ctrl shift win
        do:
            [ :target | "owner... to NautilusWindow" target owner owner owner owner owner owner takeKeyboardFocus ]
        description: 'Remove Keyboard Focus'

Note that between Pharo 4 and Pharo 5 a shortcut to go to code pane was accidentally removed. see https://github.com/peteruhnak/pharo-scripts/blob/91786ba6fd865e9bb7aeddf413e82a929c958307/config/6.0/nautilus-keyboard-focus.st for adding both shortcuts. (As Calypso should obsolete Nautilus eventually, I am not interested in fixing this in Pharo 7 (but feel free to do it yourself.)

Basic shortcuts

Package Class Protocol Method Hierarchy Test Class Superclass Subclass
Find F P F C F T F M F H - F Shift+S F S
Go (Jump) G P G C G T G M - G J C - -
Create New N P N C N T - - N J C - -
Rename R P R C R T R M - - - -
Remove X P X C X T X M - - - -
Test¹ J P J C - J M - - - -
Categorize² - M C - M M - - - -
  • G S is Go to Source code (of currently selected method)³

Notes:

  • ¹ Run tests in the selected Package, Class, Method.
  • ² Set package for class, set protocol for method.
  • ³ This shortcut is Pharo 4, and Pharo 7 (soon™) only, see links above to add it

Open New Nautilus Window

  • Browse Full - Same as the current: B F
  • Browse Scoped: B S
    • If you have focus on package, then scoped on the package
    • If focus on class or one of its methods, then scoped on the class
  • Browse Restricted Class: B R C
    • You need to have a focus on either the class, or one of its protocols or methods
  • Browse Restricted Package: B R P
    • Should work anywhere
  • Browse Restricted Subclasses: B R S
    • Scoped on the chosen class and all its subclasses in the current package
  • Browse Restricted Superclasses: B R Shift+S
    • Scoped on the chosen class and all its superclasses in the current package
  • Browse Restricted Regex: B R R
    • Scope selected packages by regex
  • Browse Variables: B V
    • Show popup with the class' variables
  • Browse Bytecode: B B
    • Switch the code editor to bytecode view
  • Browse Implementors: B M
  • Browse Senders: B N
  • Browse class references: B Shift+N

Generating

For new class/package/... see the table.

  • Accessors: H A
    • Generate missing accessors for all variables, you will be given popup where you can choose which methods you want
    • Generate
  • Initialize: H I
    • In regular class add initialize methods with instance variables set to nil
    • If initialize exists, open it
    • For TestCase subclasses, it will instead generate setUp and tearDown methods with instance variables set to nil
  • Regenerate initialize: H K
    • Same as above, but will recreate the method if it already exists
    • For TestCase same as above.
  • Create a subclass: H N S
  • Create test method and jump to it: H J
    • Creates a test method for the currently selected method and jump to it
  • Create test method without jumping: H Shift+J

Navigating

  • Class side view: T C
  • Instance side view: T I
  • Hierarchy view: T H
  • Flat view: T F
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment