Skip to content

Commit

Permalink
doc: add the keybindings to readline doc. Also -
Browse files Browse the repository at this point in the history
1. Adds ref in repl doc
2. Removes ref from tty doc

Closes: nodejs#20814
  • Loading branch information
shobhitchittora committed May 21, 2018
1 parent 13ecfa3 commit 60165b7
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 105 deletions.
105 changes: 103 additions & 2 deletions doc/api/readline.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ 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. See [`TTY keybindings`][] for a list of covered key
a [TTY][] text terminal. See [`TTY keybindings`][] for a list of key
combinations.

If `key` is specified, `data` is ignored.
Expand Down Expand Up @@ -528,6 +528,107 @@ rl.on('line', (line) => {
});
```

## TTY keybindings

<table>
<tr>
<th>Keybindings</th>
<th>Description</th>
</tr>
<tr>
<td><code>ctrl+shift+backspace</code></td>
<td>delete line left</td>
</tr>
<tr>
<td><code>ctrl+shift+delete</code></td>
<td>delete line right</td>
</tr>
<tr>
<td><code>ctrl+c</code></td>
<td>emits SIGINT</td>
</tr>
<tr>
<td><code>ctrl+h</code></td>
<td>delete left</td>
</tr>
<tr>
<td><code>ctrl+d</code></td>
<td>delete right or EOF</td>
</tr>
<tr>
<td><code>ctrl+u</code></td>
<td>delete from current to line start</td>
</tr>
<tr>
<td><code>ctrl+k</code></td>
<td>delete from current to end of line</td>
</tr>
<tr>
<td><code>ctrl+a</code></td>
<td>goto start of line</td>
</tr>
<tr>
<td><code>ctrl+e</code></td>
<td>goto to end of line</td>
</tr>
<tr>
<td><code>ctrl+b</code></td>
<td>back one character</td>
</tr>
<tr>
<td><code>ctrl+f</code></td>
<td>forward one character</td>
</tr>
<tr>
<td><code>ctrl+l</code></td>
<td>clear screen </td>
</tr>
<tr>
<td><code>ctrl+n</code></td>
<td>next history item</td>
</tr>
<tr>
<td><code>ctrl+p</code></td>
<td>prev history item </td>
</tr>
<tr>
<td><code>ctrl+z</code></td>
<td>(need clarification)</td>
</tr>
<tr>
<td><code>ctrl+w</code> or <code>ctrl+backspace</code></td>
<td>delete backwards to a word boundary</td>
</tr>
<tr>
<td><code>ctrl+delete</code></td>
<td>delete forward to a word boundary</td>
</tr>
<tr>
<td><code>ctrl+left</code></td>
<td>word left </td>
</tr>
<tr>
<td><code>ctrl+right</code></td>
<td>word right</td>
</tr>
<tr>
<td><code>meta+b</code></td>
<td>word left</td>
</tr>
<tr>
<td><code>meta+f</code></td>
<td>word right</td>
</tr>
<tr>
<td><code>meta+d</code> or <code>meta+delete</code></td>
<td>delete word right</td>
</tr>
<tr>
<td><code>meta+backspace</code></td>
<td>delete word left </td>
</tr>
</table>

[`'SIGCONT'`]: readline.html#readline_event_sigcont
[`'SIGTSTP'`]: readline.html#readline_event_sigtstp
[`process.stdin`]: process.html#process_process_stdin
Expand All @@ -536,4 +637,4 @@ rl.on('line', (line) => {
[TTY]: tty.html
[Writable]: stream.html#stream_writable_streams
[reading files]: #readline_example_read_file_stream_line_by_line
[`TTY keybindings`]: tty.html#tty_tty_keybindings
[`TTY keybindings`]: #readline_tty_keybindings
3 changes: 3 additions & 0 deletions doc/api/repl.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 [`TTY keybindings`][].

### Default Evaluation

By default, all instances of `repl.REPLServer` use an evaluation function that
Expand Down Expand Up @@ -634,3 +636,4 @@ For an example of running a REPL instance over [curl(1)][], see:
[`util.inspect()`]: util.html#util_util_inspect_object_options
[curl(1)]: https://curl.haxx.se/docs/manpage.html
[stream]: stream.html
[`TTY keybindings`]: readline.html#readline_tty_keybindings
104 changes: 1 addition & 103 deletions doc/api/tty.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,109 +158,7 @@ The `tty.isatty()` method returns `true` if the given `fd` is associated with
a TTY and `false` if it is not, including whenever `fd` is not a non-negative
integer.

## TTY keybindings

<table>
<tr>
<th>Keybindings</th>
<th>Description</th>
</tr>
<tr>
<td><code>ctrl+shift+backspace</code></td>
<td>delete line left</td>
</tr>
<tr>
<td><code>ctrl+shift+delete</code></td>
<td>delete line right</td>
</tr>
<tr>
<td><code>ctrl+c</code></td>
<td>emits SIGINT</td>
</tr>
<tr>
<td><code>ctrl+h</code></td>
<td>delete left</td>
</tr>
<tr>
<td><code>ctrl+d</code></td>
<td>delete right or EOF</td>
</tr>
<tr>
<td><code>ctrl+u</code></td>
<td>delete from current to line start</td>
</tr>
<tr>
<td><code>ctrl+k</code></td>
<td>delete from current to end of line</td>
</tr>
<tr>
<td><code>ctrl+a</code></td>
<td>goto start of line</td>
</tr>
<tr>
<td><code>ctrl+e</code></td>
<td>goto to end of line</td>
</tr>
<tr>
<td><code>ctrl+b</code></td>
<td>back one character</td>
</tr>
<tr>
<td><code>ctrl+f</code></td>
<td>forward one character</td>
</tr>
<tr>
<td><code>ctrl+l</code></td>
<td>clear screen </td>
</tr>
<tr>
<td><code>ctrl+n</code></td>
<td>next history item</td>
</tr>
<tr>
<td><code>ctrl+p</code></td>
<td>prev history item </td>
</tr>
<tr>
<td><code>ctrl+z</code></td>
<td>(need clarification)</td>
</tr>
<tr>
<td><code>ctrl+w</code> or <code>ctrl+backspace</code></td>
<td>delete backwards to a word boundary</td>
</tr>
<tr>
<td><code>ctrl+delete</code></td>
<td>delete forward to a word boundary</td>
</tr>
<tr>
<td><code>ctrl+left</code></td>
<td>word left </td>
</tr>
<tr>
<td><code>ctrl+right</code></td>
<td>word right</td>
</tr>
<tr>
<td><code>meta+b</code></td>
<td>word left</td>
</tr>
<tr>
<td><code>meta+f</code></td>
<td>word right</td>
</tr>
<tr>
<td><code>meta+d</code> or <code>meta+delete</code></td>
<td>delete word right</td>
</tr>
<tr>
<td><code>meta+backspace</code></td>
<td>delete word left </td>
</tr>
</table>

[`net.Socket`]: net.html#net_class_net_socket
[`process.stdin`]: process.html#process_process_stdin
[`process.stdout`]: process.html#process_process_stdout
[`process.stderr`]: process.html#process_process_stderr
[`TTY keybindings`]: #tty_tty_keybindings
[`process.stderr`]: process.html#process_process_stderr

0 comments on commit 60165b7

Please sign in to comment.