Edit the prompt line with keyboard shortcuts
tools & sandbox
// what it does
The input line supports readline-style editing: Ctrl+A and Ctrl+E jump to line start and end, Ctrl+K deletes to end of line, Ctrl+U deletes to the start, and Ctrl+W deletes the word to the left. For anything multi-line, Ctrl+G opens the current prompt in your external editor. Insert a newline without submitting using Ctrl+Enter (or backslash then Enter).
// shortcut
Ctrl+A
Ctrl+E
Ctrl+K
Ctrl+U
Ctrl+W
Ctrl+G
// gotcha
Ctrl+X still opens the external editor but is deprecated — the current binding is Ctrl+G (or Ctrl+Shift+G), so scripts and muscle memory should move to it. The external editor is chosen via /editor or the EDITOR environment variable.