Next: , Previous: Leaving Gforth, Up: Gforth Environment

2.3 Command-line editing

Gforth maintains a history file that records every line that you type to the text interpreter. This file is preserved between sessions, and is used to provide a command-line recall facility; if you type Ctrl-P repeatedly you can recall successively older commands from this (or previous) session(s). The full list of command-line editing facilities is:

When editing, displayable characters are inserted to the left of the cursor position; the line is always in “insert” (as opposed to “overstrike”) mode.

On Unix systems, the history file is ~/.gforth-history by default1. You can find out the name and location of your history file using:

     history-file type \ Unix-class systems
     history-file type \ Other systems
     history-dir  type

If you enter long definitions by hand, you can use a text editor to paste them out of the history file into a Forth source file for reuse at a later time.

Gforth never trims the size of the history file, so you should do this periodically, if necessary.


[1] i.e. it is stored in the user's home directory.