BFOIT - Introduction to Computer Programming

Appendix E (Editor)

Introduction

This appendix provides tips on how to use TG's Editor efficiently, e.g., some techniques are presented that cut down what you need to type to get things done.  Tables of editor commands are provided.

The TG programming environment has a built-in editor.  This editor runs in two modes, WinEdit and Emacs.  In WinEdit mode, the default, editor provides simple functionality similar to Microsoft Windows' Notepad program.  This is fine for the introductory or occasional user.

In Emacs mode, a subset of the real Emacs editor's commands are provided.  It has been added for more experienced users, many of which prefer to use keyboard commands instead of menus and the mouse.  For example, the current contents of the editor can be saved with a two character command and text selection (for copy/cut operations) can be made with keyboard commands.

WinEdit Mode Editor Commands

In the following command descriptions, characters inside square brackets means the key with a label equal to the characters inside the brackets. As an example, [Backspace] means the key labeled "Backspace" (or "Delete" on an Apple Mac).  The notation "Ctrl-x" means to hold the [Ctrl] key down and press/release the key labeled "x" and then release [Ctrl].

Command Description
[Backspace] (on Windows)
[Delete] (on Mac)
Deletes the character to the left of the cursor.
[Delete] (on Windows)  Deletes the character to the right of the cursor.
[Down Arrow] Moves the cursor down to the next line.
[End] Moves the cursor to the end of the current line.
[Home] Moves the cursor to the beginning of the current line.
[Left Arrow] Moves the cursor back one character.
[Page Down] Replaces the lines displayed with the lines below them, i.e., the next page.
[Page Up] Replaces the lines displayed with the lines above them, i.e., the previous page.
[Right Arrow] Moves the cursor forward one character.
[Up Arrow] Moves the cursor up to the previous line.
Ctrl-a Selects all of the text in the Editor.
Ctrl-c Copys highlighted text (the current selection) to a temporary holding area.
Ctrl-f Find a sequence of characters. A prompt bar pops up for entering the desired sequence of characters. An [Esc] aborts the operation.
Ctrl-g Moves the cursor to the start of a specified line. A promptbar pops up for entering the line number. An [Esc] aborts the operation.
Ctrl-n Clear the Editor for new contents. If unsaved changes currently exist in the Editor, you will be prompted to save them.
Ctrl-o The Editor prompts for the name of the file that is to be opened, replacing the current contents. If unsaved changes currently exist in the Editor, you will be prompted to save them.
Ctrl-s Save the Editor's contents to the current file name.
Ctrl-v Inserts the contents of the temporary holding area in front of the cursor.
Ctrl-x Copys highlighted text (the current selection) to a temporary holding area and then deletes it.
Ctrl-z Reverses previous change to text in editor. It can be used to back out mutiple changes, both additions and deletions.


Emacs Editor Commands

In the following command descriptions, characters surrounded by square brackets means the key with a label equal to the characters inside the brackets.  As an example, [Backspace] means the key labeled "Backspace".  The notation "Ctrl-x" means to hold the [Ctrl] key down and press/release the key labeled "x" and then release [Ctrl].

Emacs mode includes commands that are composed of multiple key sequences. As an example, the sequence [Esc]  f consists of pressing and releasing the [Esc] key followed by pressing and releasing the f key.

Command Description
[Backspace] (on Windows)
[Delete] (on Mac)
Deletes the character to the left of the cursor.
[Delete] (on Windows)  Deletes the character to the right of the cursor.
[Down Arrow] Moves the cursor down to the next line.
[End] Moves the cursor to the end of the current line.
[Home] Moves the cursor to the beginning of the current line.
[Left Arrow] Moves the cursor back one character.
[Page Down] Replaces the lines displayed with the lines below them, i.e., the next page.
[Page Up] Replaces the lines displayed with the lines above them, i.e., the previous page.
[Right Arrow] Moves the cursor forward one character.
[Up Arrow] Moves the cursor up to the previous line.
Ctrl-a Moves the cursor to the beginning of the current line.
Ctrl-b Moves the cursor back one character.
Ctrl-d Deletes the character to the right of the cursor.
Ctrl-e Moves the cursor to the end of the current line.
Ctrl-f Moves the cursor forward one character.
Ctrl-g Abort current command, e.g., text region selection or a command involving promptbar intput.
Ctrl-h Print a list of TG's supported subset of Emacs commands.
Ctrl-k Deletes all characters on the current line to the right of the cursor unless the cursor is at the end of the line. In this case, the following line is joined with the current.
Ctrl-l Make the current line this window's center line.
Ctrl-n Moves the cursor down to the next line.
Ctrl-o Opens a line (inserts a newline character) at the current position of the cursor.
Ctrl-p Moves the cursor up to the previous line.
Ctrl-r Reverse search, i.e., search backwards toward the first character in the Editor, for a sequence of characters. Ctrl-g, the abortCmd, cancels a search. Typing Ctrl-r twice in quick succession repeats a search.
Ctrl-s Search for a sequence of characters. A search promptbar pops up for entering the desired sequence of characters. Ctrl-g, the abortCmd, cancels a search. Typing Ctrl-s twice in quick succession repeats a search.
Ctrl-v Replaces the lines displayed with the lines below them, i.e., the next page.
Ctrl-w Deletes highlighted region of text (the current selection) placing it in a temporary holding area.
Ctrl-y Pastes (yanks) the contents of the temporary text holding area in front of the cursor.
Ctrl-x   Ctrl-f The Editor prompts for the name of the file that is to be opened, replacing the current contents. If unsaved changes currently exist, you will be prompted to save them.
Ctrl-x   Ctrl-s Save the Editor's contents to the current file name.
Ctrl-x   Ctrl-w Save the Editor's contents to a file. The Editor prompts for the name of the file.
Ctrl-x   Ctrl-x Exchange the current locations of the cursor and mark.
Ctrl-x   h Selects all of the text in the Editor.
Ctrl-x   i The Editor prompts for the name of a file that is to be read in and its contents inserted at the current position.
Ctrl-x   u Reverses previous change to text in the editor. Can be used to back out mutiple changes, both additions and deletions.
[Esc]   a Move the cursor back to the start of the previous Logo command.
[Esc]   b Moves the cursor back one word, to the start of the previous group of non-whitespace characters.
[Esc]   d Deletes from the cursor forward to the end of a word, to the start of the next whitespace.
[Esc]   e Moves the cursor forward to the start of the next Logo command.
[Esc]   f Moves the cursor forward one word, to the start of the next group of non-whitespace characters.
[Esc]   v Replaces the lines displayed with the lines above them, i.e., the previous page.
[Esc]   w Copies the selected region of text to a temporary holding area.
[Esc]   ( A pair of parenthesis is inserted at the current position and the cursor moves to in between them.
[Esc]   < Move the cursor to the first line in the Editor.
[Esc]   > Move the cursor to the last line in the Editor.
[Esc]   [ Moves the cursor backward to the start of the previous procedure definition, its title line.
[Esc]   ] Moves the cursor forward to the start of the next procedure definition, its title line.


Back to Appendix D (jLogo Primitives)
Go to the Table of Contents
On to Appendix F (Java Tables)

Public Domain Mark
This work (BFOIT: Introduction to Computer Programming, by Guy M. Haas),
identified by Berkeley Foundation for Opportunities in IT (BFOIT),
is free of known copyright restrictions.