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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KeybindingsDescriptionNotes
ctrl + shift + backspaceDelete line leftDoesn't work on Linux, Mac and Windows
ctrl + shift + deleteDelete line rightDoesn't work on Linux and Mac
ctrl + cEmit SIGINT or close the readline instance
ctrl + hDelete left
ctrl + dDelete right or close the readline instance in case the current line is empty / EOFDoesn't work on Windows
ctrl + uDelete from the current position to the line start
ctrl + kDelete from the current position to the end of line
ctrl + aGo to start of line
ctrl + eGo to to end of line
ctrl + bBack one character
ctrl + fForward one character
ctrl + lClear screen
ctrl + nNext history item
ctrl + pPrevious history item
ctrl + zMoves running process into background. Type + fg and press enter + to return.Doesn't work on Windows
ctrl + w or ctrl + + backspaceDelete backwards to a word boundaryctrl + backspace Doesn't + work as expected on Windows
ctrl + deleteDelete forward to a word boundaryDoesn't work on Mac
ctrl + left or + meta + bWord leftctrl + left Doesn't work + on Mac
ctrl + right or + meta + fWord rightctrl + right Doesn't work + on Mac
meta + d or meta + + deleteDelete word rightmeta + delete Doesn't work + on windows
meta + backspaceDelete word leftDoesn't work on Mac
+ [`'SIGCONT'`]: readline.html#readline_event_sigcont [`'SIGTSTP'`]: readline.html#readline_event_sigtstp [`'line'`]: #readline_event_line @@ -731,5 +857,6 @@ const { createInterface } = require('readline'); [`rl.close()`]: #readline_rl_close [Readable]: stream.html#stream_readable_streams [TTY]: tty.html +[TTY keybindings]: #readline_tty_keybindings [Writable]: stream.html#stream_writable_streams [reading files]: #readline_example_read_file_stream_line_by_line diff --git a/doc/api/repl.md b/doc/api/repl.md index b410301be23554..3b86168f64f1eb 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -69,6 +69,9 @@ The following key combinations in the REPL have these special effects: variables. When pressed while entering other input, displays relevant autocompletion options. +For key bindings related to the reverse-i-search, see [`reverse-i-search`][]. +For all other key bindings, see [TTY keybindings][]. + ### Default Evaluation By default, all instances of [`repl.REPLServer`][] use an evaluation function @@ -738,5 +741,7 @@ For an example of running a REPL instance over [curl(1)][], see: [`repl.ReplServer`]: #repl_class_replserver [`repl.start()`]: #repl_repl_start_options [`util.inspect()`]: util.html#util_util_inspect_object_options +[`reverse-i-search`]: #repl_reverse_i_search +[TTY keybindings]: readline.html#readline_tty_keybindings [curl(1)]: https://curl.haxx.se/docs/manpage.html [stream]: stream.html