- Documentation
- Reference manual
- Overview
- Getting started quickly
- The user's initialisation file
- Initialisation files and goals
- Command line options
- UI Themes
- GNU Emacs Interface
- Online Help
- Command line history
- Reuse of top-level bindings
- Overview of the Debugger
- Compilation
- Environment Control (Prolog flags)
- An overview of hook predicates
- Automatic loading of libraries
- Packs: community add-ons
- The SWI-Prolog syntax
- Rational trees (cyclic terms)
- Just-in-time clause indexing
- Wide character support
- System limits
- SWI-Prolog and 64-bit machines
- Binary compatibility
- Overview
- Packages
- Reference manual
2.8 Command line history
SWI-Prolog offers a query substitution mechanism similar to what is seen in Unix shells. The availability of this feature is controlled by set_prolog_flag/2, using the history Prolog flag. By default, history is available if no interactive command line editor is available. To enable history, remembering the last 50 commands, put the following into your startup file (see section 2.2):
:- set_prolog_flag(history, 50).
The history system allows the user to compose new queries from those typed before and remembered by the system. The available history commands are shown in table 1. History expansion is not done if these sequences appear in quoted atoms or strings.
!!. | Repeat last query |
!nr. | Repeat query numbered <nr> |
!str. | Repeat last query starting with <str> |
h. | Show history of commands |
!h. | Show this list |