Fix the doc for ttyshots.

- Wrap the command in "print" to get byte output.

- Use global-binding to ensure that the key works in all modes.
This commit is contained in:
Qi Xiao 2021-12-28 13:01:21 +00:00
parent 1d36d299b8
commit 1ec9c95142
2 changed files with 5 additions and 6 deletions

View File

@ -27,8 +27,7 @@ import (
// Example:
//
// ```elvish
// ttyshot = ~/a.html
// edit:insert:binding[Ctrl-X] = { edit:-dump-buf > $tty }
// edit:global-binding[Ctrl-X] = { edit:-dump-buf > ~/a.html }
// ```
func dumpBuf(tty cli.TTY) string {

View File

@ -1,18 +1,18 @@
This directory contains "ttyshots" -- they are like screenshots, but taken on
terminals. They are taken with Elvish's undocumented `edit:-dump-buf` function.
To take one, use the following procedure:
terminals. They are taken with Elvish's `edit:-dump-buf` function. To take one,
use the following procedure:
1. Modify `edit:rprompt` to pretend that the username is `elf` and the hostname
is `host`:
```elvish
edit:rprompt = (constantly (styled 'elf@host' inverse))
set edit:rprompt = (constantly (styled 'elf@host' inverse))
```
2. Add a keybinding for taking ttyshots:
```elvish
edit:insert:binding[Alt-x] = { edit:-dump-buf > ~/ttyshot.html }
edit:global-binding[Alt-x] = { print (edit:-dump-buf) > ~/ttyshot.html }
```
3. Make sure that the terminal width is 58, to be consistent with existing