-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: document readline keybindings #20825
Changes from all commits
13ecfa3
60165b7
c39f8b6
2faec19
e3d38dd
76d462c
67e3d92
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
||
<table> | ||
<tr> | ||
<th>Keybindings</th> | ||
<th>Description</th> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl</code> + <code>shift</code> + <code>backspace</code></td> | ||
<td>Delete line left</td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl</code> + <code>shift</code> + <code>delete</code></td> | ||
<td>Delete line right</td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does not work on WSL There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does not work on macOS. |
||
</tr> | ||
<tr> | ||
<td><code>ctrl</code> + <code>c</code></td> | ||
<td>Emit SIGINT</td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl</code> + <code>h</code></td> | ||
<td>Delete left</td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl</code> + <code>d</code></td> | ||
<td>Delete right or EOF</td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl</code> + <code>u</code></td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On Windows this deletes entire line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On WSL also There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also on Liux |
||
<td>Delete from current to line start</td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl</code> + <code>k</code></td> | ||
<td>Delete from current to end of line</td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl</code> + <code>a</code></td> | ||
<td>Go to start of line</td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl</code> + <code>e</code></td> | ||
<td>Go to to end of line</td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl</code> + <code>b</code></td> | ||
<td>Back one character</td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl</code> + <code>f</code></td> | ||
<td>Forward one character</td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl</code> + <code>l</code></td> | ||
<td>Clear screen</td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl</code> + <code>n</code></td> | ||
<td>Next history item</td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl</code> + <code>p</code></td> | ||
<td>Previous history item</td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl</code> + <code>z</code></td> | ||
<td>Moves running process into background. Type | ||
<code>fg</code> and press <code>enter</code> | ||
to return.</td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does not work on Windows There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
</tr> | ||
<tr> | ||
<td><code>ctrl</code> + <code>w</code> or <code>ctrl</code> | ||
+ <code>backspace</code></td> | ||
<td>Delete backwards to a word boundary</td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also does not work on WSL There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also not on Linux (ctrl+backspace) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ctrl+w works on macOS but cntrl+backspace seems to delete forward to a word boundary? |
||
</tr> | ||
<tr> | ||
<td><code>ctrl</code> + <code>delete</code></td> | ||
<td>Delete forward to a word boundary</td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does not work on WSL There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does not work on macOS |
||
</tr> | ||
<tr> | ||
<td><code>ctrl</code> + <code>left</code></td> | ||
<td>Word left </td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On macOS, it's command+option+left. ctrl+left does not work. |
||
</tr> | ||
<tr> | ||
<td><code>ctrl</code> + <code>right</code></td> | ||
<td>Word right</td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On macOS, it's command+option+right. ctrl+right does not work. |
||
</tr> | ||
<tr> | ||
<td><code>meta</code> + <code>b</code></td> | ||
<td>Word left</td> | ||
</tr> | ||
<tr> | ||
<td><code>meta</code> + <code>f</code></td> | ||
<td>Word right</td> | ||
</tr> | ||
<tr> | ||
<td><code>meta</code> + <code>d</code> or <code>meta</code> | ||
+ <code>delete</code></td> | ||
<td>Delete word right</td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also on WSL There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On macOS, meta+d works, but meta+delete does a delete word left rather than right. |
||
</tr> | ||
<tr> | ||
<td><code>meta</code> + <code>backspace</code></td> | ||
<td>Delete word left </td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does not work on macOS. |
||
</tr> | ||
</table> | ||
|
||
[`'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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not work on Windows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not work on WSL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not work on macOS.