This shows you the differences between two versions of the page.
interface [2010-01-23 19:34] asciiphil created |
interface [2021-02-16 07:59] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | This is just a skeleton for now. | + | ====== Interacting with screen ====== |
- | | + | ===== Basics ===== |
- | * '' | + | |
- | * '' | + | This set of commands is mostly about customizing '' |
- | * '' | + | in terms of keybindings. |
- | * '' | + | '' |
- | * '' | + | prefix escape character. |
- | * '' | + | a different prefix, since '' |
- | * '' | + | |
- | * '' | + | The '' |
- | * '' | + | to add or redefine '' |
- | * '' | + | '' |
- | | + | defines keys in '' |
- | | + | "'' |
- | | + | '' |
+ | '' | ||
+ | keypress, not just ones preceded by '' | ||
+ | also modify the keypresses used in [[commands: | ||
+ | |||
+ | You can use '' | ||
+ | keybindings is. | ||
+ | |||
+ | ===== Extras ===== | ||
+ | |||
+ | ==== bindkey Tables ==== | ||
+ | |||
+ | Technically, | ||
+ | '' | ||
+ | key, '' | ||
+ | there; if it is, then the bound action is taken. | ||
+ | changes the user translation table by default, and most arbitrary | ||
+ | keybindings should go there. | ||
+ | an entry for the key pressed, '' | ||
+ | translation table; if nothing is there, the keypress gets sent to the | ||
+ | window. | ||
+ | '' | ||
+ | send for a function key. | ||
+ | |||
+ | The third input translation table is for [[commands: | ||
+ | use it to change the keys used in that mode. This works a little | ||
+ | differently than the other modes, because there aren't commands for the | ||
+ | things you can do in copy mode. You can, of course, bind any of | ||
+ | '' | ||
+ | copy-mode-specific commands, you have to use '' | ||
+ | stuff the key sequence for the action you want to take. You can use this | ||
+ | functionality to remap copy mode key bindings, but that's better done with | ||
+ | the '' | ||
+ | useful when you want to chain several actions together. | ||
+ | |||
+ | '' | ||
+ | default and copy mode tables with the '' | ||
+ | respectively. | ||
+ | keybinding, it will display the current bindings for the selected mode. | ||
+ | |||
+ | ==== Command Classes ==== | ||
+ | |||
+ | Command classes are how you can implement multi-key bindings in | ||
+ | '' | ||
+ | the user presses. | ||
+ | keypress.) | ||
+ | that the first keypress activates a command class, where that command | ||
+ | class contains a binding for the next key, and so on. This is effectively | ||
+ | how normal '' | ||
+ | command class, which contains all of the default bindings, plus any that | ||
+ | you've added with '' | ||
+ | |||
+ | You " | ||
+ | Without any arguments, it activates the default command class (just like | ||
+ | '' | ||
+ | to it. Similarly, '' | ||
+ | in the specified command class. | ||
+ | |||
+ | (To be fair, command classes are just the most flexible way to implement | ||
+ | multi-key bindings in '' | ||
+ | will bind commands to strings as well as single characters. | ||
+ | characters in the string arrive quickly enough (faster than | ||
+ | '' | ||
+ | option will even disable the timeout.) | ||
+ | |||
+ | ==== Quoting ==== | ||
+ | |||
+ | Sometimes you don't want to activate a keybinding. | ||
+ | '' | ||
+ | be checked against the user input translation table (see | ||
+ | [[interface# | ||
+ | keybindings except the ones needed for its terminal emulation. | ||
+ | need to bypass the default input translation table too, use | ||
+ | '' | ||
+ | |||
+ | ==== Faking Keypresses ==== | ||
+ | |||
+ | The '' | ||
+ | to the current window. | ||
+ | places where it's useful. | ||
+ | |||
+ | ===== Keybindings ===== | ||
+ | |||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | ===== Commands ===== | ||
+ | |||
+ | | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | ===== Examples ===== | ||
+ | |||
+ | ==== Different Prefix Keys ==== | ||
+ | |||
+ | '' | ||
+ | When doing that, you have to decide whether two escapes in a row will call | ||
+ | '' | ||
+ | '' | ||
+ | an example of each: | ||
+ | |||
+ | < | ||
+ | # ESC ESC calls meta | ||
+ | escape ^[^[ | ||
+ | # ESC o calls other | ||
+ | bind o other | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | # ESC [ calls meta | ||
+ | escape ^[[ | ||
+ | # ESC ESC calls other by default | ||
+ | </ | ||
+ | |||
+ | '' | ||
+ | because it interferes with '' | ||
+ | '' | ||
+ | programs in new windows, rather than having to suspend the current program | ||
+ | first: | ||
+ | |||
+ | < | ||
+ | escape ^zz | ||
+ | </ | ||
+ | |||
+ | ==== bindkey Examples ==== | ||
+ | |||
+ | The default input translation table is for terminal behavior. | ||
+ | with a terminal that wasn't sending the right character for its backspace | ||
+ | button, you could use screen to " | ||
+ | |||
+ | < | ||
+ | bindkey -d -k kb stuff " | ||
+ | </ | ||
+ | |||
+ | The copy mode input translation table can be used to automate things in | ||
+ | copy mode. This causes '' | ||
+ | the buffer and copy the entire line it's on: | ||
+ | |||
+ | < | ||
+ | bindkey -m ^G stuff " | ||
+ | </ | ||
+ | |||
+ | ==== Command Class Examples ==== | ||
+ | |||
+ | You can use the default command class to make a second escape key. | ||
+ | Suppose you want both '' | ||
+ | it like this: | ||
+ | |||
+ | < | ||
+ | escape ^zz | ||
+ | bindkey ^\ command | ||
+ | </ | ||
+ | |||
+ | Let's say you wanted to to make the split commands a little more mnemonic | ||
+ | and use '' | ||
+ | vertically", | ||
+ | |||
+ | < | ||
+ | bind s command -c split_class | ||
+ | bind -c split_class h split | ||
+ | bind -c split_class v split -v | ||
+ | </ | ||
+ | |||
+ | The '' | ||
+ | command classes to make bindings to select windows numbered higher than 9. | ||
+ | |||
+ | ==== Quoting Examples ==== | ||
+ | |||
+ | It's often useful to have a quote key that sends the next keypress through | ||
+ | unintercepted. | ||
+ | |||
+ | < | ||
+ | bind ^Q mapdefault | ||
+ | </ | ||
+ | |||
+ | With that, you can press ''C-a C-q // | ||
+ | will be passed through to the window (unless it's affected by the default | ||
+ | input translation table, but you generally want those to still be mapped, | ||
+ | because they affect '' | ||
+ | |||
+ | ==== emacs-Friendly copy Mode ==== | ||
+ | |||
+ | The keybindings in [[commands:copy]] mode are mostly based on '' | ||
+ | (although it has '' | ||
+ | remapping that makes some of the keys closer: | ||
+ | |||
+ | < | ||
+ | markkeys j=^N: | ||
+ | bindkey -m -t ^[v stuff ^B | ||
+ | bindkey -m ^B stuff h | ||
+ | bindkey -m -t ^[a stuff \^ | ||
+ | bindkey -m -t ^[f stuff w | ||
+ | bindkey -m -t ^[b stuff b | ||
+ | bindkey -m -t ^[0^[r stuff H | ||
+ | # Nothing for ' | ||
+ | bindkey -m -t ^[-^[r stuff L | ||
+ | bindkey -m -t ^[< | ||
+ | bindkey -m -t ^[> | ||
+ | bindkey -m -t ^[d stuff " e " | ||
+ | </ | ||
+ | |||
+ | '' | ||
+ | '' | ||
+ | specify a meta key, but you can use the combination with escape that is | ||
+ | equivalent. | ||
+ | a meta-key combination is pressed.) | ||
+ | |||
+ | A more complete mapping is left as an exercise for the reader. | ||
+ | |||
+ | ==== xterm-Style Scrolling ==== | ||
+ | |||
+ | In '' | ||
+ | scrollback buffer. | ||
+ | window, so this example lets you use those keypresses to move around | ||
+ | '' | ||
+ | |||
+ | First, you need to disable scrolling in '' | ||
+ | .Xresources file: | ||
+ | |||
+ | < | ||
+ | XTerm.vt100.translations: | ||
+ | Shift < | ||
+ | Shift < | ||
+ | </ | ||
+ | |||
+ | Then you need to make shift-PgUp enter [[commands: | ||
+ | a page, and both key combinations move around in copy mode. This goes in | ||
+ | your .screenrc: | ||
+ | |||
+ | < | ||
+ | bindkey " | ||
+ | bindkey -m " | ||
+ | bindkey -m " | ||
+ | </ | ||