Keyboard Shortcuts
Alpha
Version:9.2.3 - "Suhail"
Last update:2021-05-21 14:43:31






This help file describes some of the default keyboard shortcuts (also referred to as key bindings in some of Alpha's documentation) with this installation of Alpha, how to determine what certain keys are bound to, and how to create your own custom shortcuts.

Introduction

There are basically three different ways editor functions can be invoked: It is the last two options that we are concerned with in this document. By default, Alpha has well over 300 different keyboard shortcuts, far more than you would ever want to memorize. However, the shortcuts are there only for your convenience. You don't need to use any of them, but many people find that using the mouse for common editing functions seriously slows them down.
The Alpha ↣ Global Setup ↣ Keyboard Shortcuts ↣ Menu Shortcuts command will open a dialog allowing you to change many of Alpha's keyboard shortcuts associated with menu commands.
Many packages defining an additional menu also provide a Menu Shortcuts command of their own in order to define or modify key combinations related to their items. See the Menu-Shortcuts Preferences panel.
If the menu path of the command you wish to change doesn't appear in this dialog, then read on for more information. Note that this dialog should only list the menu names which are currently visible, i.e. it is mode-specific. If you want to change the shortcuts in the package Stata Menu, for example, the active window must be in Stata mode. Similarly, if you want to change the shortcuts for the package Www Menu, it must be turned on globally.

Mac OS X notes

Some Mac OS X keyboard shortcuts conflict with those which Alpha has used for many years. ⌥⌘D is one example -- while this shortcut has been mapped to Text ↣ Uncomment Line in Alpha since the early 1990s, Mac OS X 10.3 took it over to toggle hiding the Dock.
These conflicts can be resolved in either of two ways:
  1. Change Alpha's keyboard shortcut for the offending items. Select the command Alpha ↣ Global Setup ↣ Keyboard Shortcuts ↣ Menu Shortcuts and navigate to the name of the menu that contains the item that needs to be changed (such as Text for the Comment Line command). Press the Change button and adjust the shortcut as desired. See the Menu-Shortcuts Preferences panel.
  2. Disable these OS shortcuts for all applications, including Alpha. Open the Shortcuts panel of the Keyboard System Preferences panel, and turn off those items that are in conflict with the Alpha shortcuts that you need in order to perform your basic editing tasks.

Describing Shortcuts

To quickly find out what a specific key is bound to, use the menu command Alpha ↣ Global Setup ↣ Keyboard Shortcuts ↣ Describe Shortcut, and then press the key combination in question. For example, press ⌘S (Command is the Apple key on the Macintosh, by the way) and you'll see that ⌘S is bound to a command string like menu::fileProc menu7 "save".
Sometimes the information given will seem somewhat cryptic, because these are the actual Tcl commands, but in general it is easy to decipher what is going on.
If you take a look at the File menu, you'll see that Save also gives the keyboard shortcut information: if you find yourself using the same menu commands over and over again, learning a few of these shortcuts can save a lot of time and travel of the mouse.
The Alpha ↣ Global Setup ↣ Keyboard Shortcuts ↣ List All Shortcuts menu item will list all current keyboard shortcuts, or you could just click here. If you want more information regarding what an item does, shift-command-double-click on the listed Tcl procedure to open the file containing its definition.

Global Keyboard Shortcuts

The following is a list of some of the most commonly used keyboard shortcuts in Alpha's default setup, those that are generally not listed in any menus.
Emacs user will also be happy to know that many of the basic keyboard shortcuts used in Emacs are supported by Alpha. However, this requires that you switch on the Emacs package. Read more in the Emacs Help file.

Help

Helpopen the Alpha Manual help file

Moving the Cursor

Left-Arrowbackward character
Right-Arrowforward character
Up-Arrowprevious-line
Down-Arrownext-line
⌘-Leftbeginning of line
⌘-Rightend of line
⌥-Leftbackward one word
⌥-Rightforward one word
⌘-Up or Homebeginning of window
⌘-Down or Endend of window
⌥-Up or Pageupmove one page backward
⌥-Down or Pagedownmove one page forward
⌃-Upscroll window up one line
⌃-Downscroll window down one line

Selecting Text

⇧-Leftextend selection one char left
⇧-Rightextend selection one char right
⇧-Upextend selection one line up
⇧-Downextend selection one line down
⌥⇧-Leftextend selection one word left
⌥⇧-Rightextend selection one word right
⌃Hselect next word
⇧⌘-Leftselect to beginning of line
⇧⌘-Rightselect to end of line

Deleting Text

Clear or ⌃Ddelete forward char
Deletedelete backward char
⌥⇧-Deletedelete forward word
⌥-Deletedelete backward word
Note that additionally ⌃D, ⌥D, ⌥H, and ⌃K are available after the package emacs has been turned on (see Emacs Help).

Twiddle, Shifting Text

The following functions are found in the Edit menu. The keyboard shortcuts to these functions are dependent on your particular keyboard layout (see the International Preferences panel). If you turn on the right keyboard, then you will have appropriate bindings for the commands described in the following table.
TwiddleExchange characters surrounding cursor.
Twiddle WordsExchange words surrounding cursor
Shift LeftShift selection left one tab.
Shift Left SpaceShift selection left one space.
Shift RightShift selection right one tab.
Shift Right SpaceShift selection right one space.
For instance, on a US keyboard, the shortcut for Shift Right is ⌘]. This shortcut is not easy to obtain on a french keyboard: so if you happen to have a french keyboard, select it in the International Preferences panel and Alpha will automatically change the shortcut to something easier (namely ⌘).

The Numeric Keypad

Alpha is able to use the numeric keypad as a navigation tool. Press ⇧-Clear (or ⇧-Numlock) to turn on/off this feature or use the Num Lock preference in the General panel of the Global Preferences. You can also click here to toggle the behavior of the keypad: toggle Num Lock.
When Alpha takes over the keypad, the following functions are available:
Keypad-0
Scroll back one page.
Keypad-1
Jump to the start of the nearest function above the current position (see first note below).
Keypad-2
Selects region between cursor and Window Pin, i.e Search ↣ The Pin ↣ Hilite To Pin.
Keypad-3
Jump to the start of the nearest function below the current position (see first note below).
Keypad-4
Move to beginning of current word.
Keypad-5
Sets Window Pin to cursor location and moves cursor to previous Pin, i.e. Search ↣ The Pin ↣ Exchange Point And Pin.
Keypad-6
Move to end of current word.
Keypad-7
Delete all characters from current insertion point to beginning of word.
Keypad-8
Put cursor at top of document.
Keypad-9
Delete all characters from current insertion point to end of word.
Keypad-.
Put cursor at bottom of document.
Keypad-+
Cycles between the two topmost windows.
Keypad--
Makes the previous window topmost.
Use the following keys to toggle the keypad behavior:
⇧-ClearTurns Num-Lock off, allowing you to use the keypad for numbers
ClearMove the current line to the top of the window
EnterPage forward
or click here to toggle forth and back: toggle Num Lock.
The keypad bindings are extremely useful for navigating across text chunks. Try paste-ing a large chunk of text, and then immediately hit Keypad-5. Try put cursor at top/bottom of document (Keypad-0 or .), and then immediately hit Keypad-5. After a few minutes, you won't be able to live without Keypad-5...
Notes:

The Return key

Many modes have defined sophisticated indentation routines that are often specific to the context surrounding the cursor position. When this is the case, the mode will have an Indent On Return preference that can be turned on and off. When it is turned on, pressing Return will automatically indent the new line that is created. See the Mode Preferences panel.
Even if this preference is turned off, you can always indent the current line using the Text ↣ Indent Line/Selection menu commands. In addition, pressing ⌘-Return will always indent the new line, while ⌃-Return will always insert a new line without indentation.

Other Special Keys

The menu item Alpha ↣ Global Setup ↣ Keyboard Shortcuts ↣ Special Keys will open a dialog allow you to define global keyboard shortcuts to particular functions. For more information, see the Electric Bindings section of the Electrics Help file.

Defining custom bindings

Keyboard bindings do not necessarily have to be attached to a menu item. It is possible to simply associate a command or a procedure to a key combination. This requires a minimal knowledge of the Tcl language. The [binding] command is the basic command used to create, modify, delete these kinds of keyboard shortcuts. See the [binding] reference page for complete information about this command.

Mode Specific Shortcuts

Be aware that each file has a mode associated with it that may define additional keyboard shortcuts. The Alpha ↣ Mode Setup ↣ Describe Mode menu item will list mode-specific shortcuts for the mode of the current window.
LaTeX-specific shortcuts can also be found in latexKeys.tcl.

User Defined Keyboard Shortcuts

This section gives information about how to customize the menu shortcuts in Alpha. It explains, from the user's point of view, how one can attach a menu shortcut (aka keyboard equivalent) to a menu item, change an existing shortcut or restore the original one.
The information below is intended for users: developers who are interested in providing support for user-defined menu shortcuts in their package should read the Providing customisable menu shortcuts section in the file Extending Alpha.
Menu shortcuts customization is a per-package feature. This means that not all menus offer the possibility of assigning or customizing shortcuts but most of them do. This includes:

The user shortcuts interface

Some of the packages mentioned above provide somewhere a menu item named Menu Shortcuts, or Assign Menu Shortcuts, or something similar. For instance, the shortcuts of the basic menus can be assigned via the command Alpha ↣ Global Setup ↣ Keyboard Shortcuts ↣ Menu Shortcuts.
Menu packages like the Electric menu, the Filters menu, etc. also have such an item. On the contrary, some packages do not expose a Menu Shortcuts command of their own but rely on another package to provide this functionnality. This is essentially the case of the packages which insert a submenu in one of the basic menus: they use the same command as the basic menus themselves.
Setting a menu shortcut is done in a preferences dialog invoked when one selects the appropriate Menu Shortcuts command: this dialog displays a list of all the menus or submenus whose shortcuts are configureable. One must first select a menu or submenu, then click on one of the two buttons located next to the list: Click on the Close button when you are finished with the Menu Shortcuts dialog. Normally you should see the newly defined shortcuts in the corresponding menu or submenu (see the next section if this is not the case).

Troubleshooting menu shortcuts

Beware that some packages define mode-specific bindings rather than global bindings: this is the case of the mode menus, like the LaTeX menu, the HTML menus, the Postcript menu, etc. Mode specific bindings are displayed in the menus only if the currently opened window is edited in this mode: for instance, if you define menu shortcuts in the LaTeX menu, these shortcuts will be displayed in the menu only if the current window is in TeX mode.
Some packages do not let you assign a shortcut to all the items: this is the case for instance of the Open Windows package and the Recent File package. The Open Windows menu maintains a list of the currently opened windows in the bottom part of the menu (and automatically assigns keyboard equivalents, ⌘1 to ⌘9): only the permanent items in the top part of the menu can be assigned a shortcut. The Open Recent submenu of the File menu maintains a list of the most recent files edited in Alpha in the top part of the menu: only the permanent items in the bottom part of the menu can be assigned a shortcut.
In the case of composite bindings, if a prefix is not present in the list displayed by the Set Shortcut dialog, it means that no binding has been defined to link this prefix to the [prefixBinding] command: you will have to define it yourself.

What to bind to?

When you want to define a new keyboard shortcut, you obviously want to use a key combination which is not already in use. There are two different ways to find if a key combination is free:
  1. First, the menu item Alpha ↣ Global Setup ↣ Keyboard Shortcuts ↣ List All Shortcuts will list all of the shortcuts currently in effect.
  2. Second, you can use Alpha ↣ Global Setup ↣ Keyboard Shortcuts ↣ Describe Shortcut to find what a certain key combination is bound to. Select Alpha ↣ Global Setup ↣ Keyboard Shortcuts ↣ Describe Shortcut and then hit the key combination you are interested in. Alpha will then display a dialog saying which function the key combination is bound to, or Key combination unbound. if it is not bound to anything.
There is one thing to note about shortcuts involving the Shift modifier (). If there is nothing bound to a key combination including the Shift key, typing this key combination will have the same effect as the one without the Shift key. A specific example to clarify: "⌘P" is bound to print, but there is no shortcut defined for "⇧⌘P". Pressing "⇧⌘P" has the same effect as hitting ⌘P. But if you now define a new binding for "⇧⌘P", then "⌘P" and "⇧⌘P" will have different functionality.

License and Disclaimer

This document has been placed in the public domain. The initial author is Pete Keleher. Updated by Craig Barton Upright, Donavan Hall.
Copyright (c) 2021, the Alpha Community.
All rights reserved.
This software is free software and distributed under the terms of the new BSD license:
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ALPHA COMMUNITY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.