diff --git a/doc/api/readline.md b/doc/api/readline.md index cbb844886d6647..e54bfec7686337 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -293,7 +293,8 @@ added: v0.1.98 The `rl.write()` method will write either `data` or a key sequence identified by `key` to the `output`. The `key` argument is supported only if `output` is -a [TTY][] text terminal. +a [TTY][] text terminal. See [TTY keybindings][] for a list of key +combinations. If `key` is specified, `data` is ignored. @@ -722,6 +723,131 @@ const { createInterface } = require('readline'); })(); ``` +## TTY keybindings + +
Keybindings | +Description | +Notes | +
---|---|---|
ctrl + shift + backspace |
+ Delete line left | +Doesn't work on Linux, Mac and Windows | +
ctrl + shift + delete |
+ Delete line right | +Doesn't work on Linux and Mac | +
ctrl + c |
+ Emit SIGINT or close the readline instance |
+ + |
ctrl + h |
+ Delete left | ++ |
ctrl + d |
+ Delete right or close the readline instance in case the current line is empty / EOF | +Doesn't work on Windows | +
ctrl + u |
+ Delete from the current position to the line start | ++ |
ctrl + k |
+ Delete from the current position to the end of line | ++ |
ctrl + a |
+ Go to start of line | ++ |
ctrl + e |
+ Go to to end of line | ++ |
ctrl + b |
+ Back one character | ++ |
ctrl + f |
+ Forward one character | ++ |
ctrl + l |
+ Clear screen | ++ |
ctrl + n |
+ Next history item | ++ |
ctrl + p |
+ Previous history item | ++ |
ctrl + z |
+ Moves running process into background. Type
+ fg and press enter
+ to return. |
+ Doesn't work on Windows | +
ctrl + w or ctrl
+ + backspace |
+ Delete backwards to a word boundary | +ctrl + backspace Doesn't
+ work as expected on Windows |
+
ctrl + delete |
+ Delete forward to a word boundary | +Doesn't work on Mac | +
ctrl + left or
+ meta + b |
+ Word left | +ctrl + left Doesn't work
+ on Mac |
+
ctrl + right or
+ meta + f |
+ Word right | +ctrl + right Doesn't work
+ on Mac |
+
meta + d or meta
+ + delete |
+ Delete word right | +meta + delete Doesn't work
+ on windows |
+
meta + backspace |
+ Delete word left | +Doesn't work on Mac | +