diff --git a/doc/api/readline.md b/doc/api/readline.md index a2a4adf3093a9a..88f369c6541872 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -287,7 +287,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. @@ -527,11 +528,117 @@ rl.on('line', (line) => { }); ``` +## TTY keybindings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KeybindingsDescription
ctrl + shift + backspaceDelete line left
ctrl + shift + deleteDelete line right
ctrl + cEmit SIGINT
ctrl + hDelete left
ctrl + dDelete right or EOF
ctrl + uDelete from current to line start
ctrl + kDelete from current to 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.
ctrl + w or ctrl + + backspaceDelete backwards to a word boundary
ctrl + deleteDelete forward to a word boundary
ctrl + leftWord left
ctrl + rightWord right
meta + bWord left
meta + fWord right
meta + d or meta + + deleteDelete word right
meta + backspaceDelete word left
+ [`'SIGCONT'`]: readline.html#readline_event_sigcont [`'SIGTSTP'`]: readline.html#readline_event_sigtstp [`process.stdin`]: process.html#process_process_stdin [`process.stdout`]: process.html#process_process_stdout [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 356d5ef47e206f..bde5cbd40affaa 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -67,6 +67,8 @@ The following key combinations in the REPL have these special effects: variables. When pressed while entering other input, displays relevant autocompletion options. +For a full list of special keys, refer to [TTY keybindings][]. + ### Default Evaluation By default, all instances of `repl.REPLServer` use an evaluation function that @@ -632,5 +634,6 @@ For an example of running a REPL instance over [curl(1)][], see: [`readline.InterfaceCompleter`]: readline.html#readline_use_of_the_completer_function [`readline.Interface`]: readline.html#readline_class_interface [`util.inspect()`]: util.html#util_util_inspect_object_options +[TTY keybindings]: readline.html#readline_tty_keybindings [curl(1)]: https://curl.haxx.se/docs/manpage.html [stream]: stream.html