Key Bindings
Haskeline provides a line-editing user interface with many interactivity commands. Currently the user may choose either Emacs or Vi style bindings by editing the ~/.haskeline file; see System.Console.Haskeline.Prefs for more details.
Definitions:
- ^A: Control-A
- M-A: Option-A
- [printable char]: Any Unicode printable character (Data.Char.isPrint returns True)
- [kill]: the console's 'kill' character (usually ^U)
Commands shared by both bindings
| Left/right arrow | move the cursor left/right by one character
|
| Return | finish the line entry
|
| Backspace | delete the character left of the cursor
|
| Delete | delete the character right of the cursor
|
| [printable char] | insert a character
|
| Up/down arrow | move backwards/forwards in the command history
|
| Tab | run tab completion
|
| ^L | clear the screen
|
| ^R | search backwards in history
|
| ^S | search forwards in history
|
| [kill] | delete until the start of the line
|
Emacs-specific bindings
| ^A | move to the start of the line
|
| ^E | move to the end of the line
|
| ^B | move left one character
|
| ^F | move right one char
|
| ^D | delete the character to the right of the cursor
|
| | ^D is treated as an EOF if the input line is empty and the last character pressed was not also ^D.
|
| M-F | move forwards one word
|
| M-B | move backward one word
|
| M-W | delete backwards one "big word"
|
| M-Backspace | delete backwards one word
|
| M-D | delete forwards one word
|
| ^K | delete until the end of the line
|
Vi-specific bindings
The Vi bindings start in "insert mode" allowing all of the shared commands listed above. Pressing ESCAPE enters the "command mode" which provides all of the shared commands except
for [printable char] and Tab, allowing instead the following commands:
| i | enter insert mode
|
| I | enter insert mode at the start of the line
|
| a | enter insert mode after the current character
|
| A | enter insert mode at end of the line
|
| s | delete the char under the cursor and enter insert mode
|
| S | clear the line and enter insert mode
|
| r | replace one character
|
| R | replace many characters
|
| [n][movement] | do a movement, repeated n times
|
| [n]d[movement] | delete the characters the movement would move past
|
| [n]c[movement] | delete the characters the movement would move past, and enter insert mode
|
| [n]x | delete the character under the cursor (repeated n times)
|
| dd | delete the whole line
|
| cc | delete the whole line and enter insertmode
|
The movement commands are:
| h | left one character
|
| l | right one character
|
| [space] | right one character
|
| w | right one word
|
| b | left one word
|
| W | right one bigword
|
| B | left one bigword
|
| 0 | move to the start of the line
|
| $ | move to the end of the line
|