### Using Eddie shell commands

In addition to bash commands, binary command line tools, shell scripts, etc., Eddie defines some special commands that are integrated into the shell and allow the user to perform Eddie specific functions:

File | opens a file
Line | selects a line
Windows | prints the paths of all the open windows
SetKey | define keyboard shorcuts for editor commands
UnsetKey | forget keyboard shorcuts for editor commands
EditKeymap | activate a specific keymap for editing
NewKeymap | defines a new keymap and makes it used with SetKey
SetDefaultKeymap | Makes a specified keyboard the default keyboard
SetAlternate[1-4]Keymap | Sets specified keyboard to be alternate1 thru alterante4
CopyKeymap | creates a new keymap, initially a copy of an existing one
Primitives | print out all keyboard primitives

### File

Format:

    	File <filename> [-shell] [-forceText]

Opens a file specified by a full path. If -shell specified document will be opened as a shell. If -forceText specified, file will be opened as a text document even though it is a workset.

### Line

Format:

    	Line <lineNumber>

Selects the specified line number.
Like other commands, you may execute two semicolon-separated Eddie commands at once:

    File "${EDDIE_HOME}"/'Release notes'; Line 10

It is not an accident that this is in fact the format in which the Metrowerks compiler for PPC, mwcc, generates it's error output. You can just select the error output in a shell window right after the compiler stops and execute it to select the line with the error.

### Windows

Format:

    	Windows [-o]

Prints the paths of all the open windows. Using the -o option causes File to be prepended to each line - this let's one reopen all the files by selecting and executing the list.

### SetKey

Format:

    	SetKey [ [modifier-keys] key [ <primitiveFunction> ] ]

Binds the specified key-modifier combination with an editor primitive function. For instance:

    	SetKey Alt-Control-Win-Shift-X ExtendToLine

Try not to break your fingers when testing this one. When you execute a command like this in a shell window, the keyboard combination remains active until it gets redefined or until Eddie quits. To make it permanent, add the command to the UserStartup file.

If you execute SetKey without any parameters, you get a listing of all the keyboard combinations in the current key map. Note that they are in a ready-to execute format.

If you are trying to find out which shortcut a particular command is bound to, you may use the following format:

    	SetKey | grep SmartSwap

In the example above, we are looking at which keyboard shortcut SmartSwap is bound to. Note that SetKey, as well as other Eddie commands are integrated with the rest of the bash shell and operations, such as piping or redirecting input and output work as expected.

The following modifier keys may be specified:

Mac | PC
Shift | Shift
Command | Alt
Control | Control
Caps | Caps
ScrollLock | ScrollLock
NumLock | NumLock
Option | Win
LeftShift | LeftShift
RightShift | RightShift
LeftCommand | LeftAlt
RightCommand | RightAlt
LeftControl | LeftControl
RightControl | RightControl
LeftOption | LeftWin
RightOption | RightWin

The Mac and PC modifier names are interchangeable, you may use the PC names on a Mac and vice-versa. This is to allow sharing the same UserStartup on both platforms.

The left/right flavors of the various modifiers bind a keyboard shortcut to that specific modifier only (for instance SetKey RightShift-A will have no effect when pressing A with the left shift key down). The modifier names without the left/right flavor specification work with either of the modifier pair.

Special key names:

Backspace | disguised as Delete on some Mac keyboards
Return |
Space |
Tab |
Escape |
LeftArrow |
RightArrow |
UpArrow |
DownArrow |
Insert | Ins/Help on Mac keyboards
Delete | Del on Mac keyboards
Home |
End |
PageUp |
PageDown |
F1 | function key 1
F2 | etc.
F3 |
F4 |
F5 |
F6 |
F7 |
F8 |
F9 |
F10 |
F11 |
F12 |
PrintScreen |
ScrollLock |
Pause |

Alternate special key names (numerical keypad)

Kp0 | numerical keypad 0
Kp1 | etc.
Kp2 |
Kp3 |
Kp4 |
Kp5 |
Kp6 |
Kp7 |
Kp8 |
Kp9 |
Enter | Enter at the very right-bottom corner of the keyboard
KpDel | numerical keypad Del/.
KpDel | numerical keypad Del/.
Kp+ | numerical keypad +
Kp- | numerical keypad -

If any of the alternate numerical keypad key names is used in a SetKey command, that command will be independent of the corresponding keyboard shortcut on the main keyboard. For instance mapping

    SetKey Option-Enter Beep

will cause a beep when pressing the Enter key with an Option (Windows) key but not when pressing Return and Option. If unassigned however, pressing a keyboard combination shortcut using Enter will do the same as the equivalent shortcut with Return. (Note that some keyboards have two Enter keys, you will have to make a mental transformation and think of the one to the right of the main keyboard area, above right Shift, as Return).

### UnsetKey

Format:

    	UnsetKey modifiers-key

Removes a keyboard shortcut previously defined by SetKey. This command is not used often, you may use it for instance when you keep the UserStartup distributed with Eddie as is and add all your private keyboard shortcuts to a personal UserStartup in ~/config/Eddie. (This way you can easily upgrade to a new version of Eddie and keep your old settings, without having to edit the new UserStartup.) You may then remove a specific keyboard shortcut that you do not want defined without modifying the original UserStartup.

More keymap setup shell commands