「xterm中的快捷键绑定」

  LINUX MANUAL PAGES

XTerm中定义了一系列的用于操作终端的”Action”。比如:copy-selection(), hard-reset(), scroll-back()等。这些Action可以结合translations映射到鼠标和键盘。比如:可以映射Ctrl + M和Ctrl + R用于最大化/还原窗口:
XTerm.vt100.translations: #override \n\
Ctrl <Key>M: maximize() \n\
Ctrl <Key>R: restore()

#override表示覆盖任何原有的绑定。每个绑定必须由\ n分隔。如果要插入文字的换行符,还需要转义(因此是\n\)。有关完整的操作列表和许多示例,可以参阅man 1 xterm的KEY BINDINGS部分。以下的内容取自man 1 xterm中的KEY BINDINGS部分。

KEY BINDINGS

It is possible to rebind keys (or sequences of keys) to arbitrary strings for input, by changing the

translations resources for the vt100 or tek4014 widgets. Changing the translations resource for

events other than key and button events is not expected, and will cause unpredictable behavior.

Action 列表

The following actions are provided for use within the vt100 or tek4014 translations resources:

allow-bold-fonts(on/off/toggle)
This action sets, unsets or toggles the allowBoldFonts resource and is also invoked by the

allow-bold-fonts entry in fontMenu.

allow-color-ops(on/off/toggle)
This action sets, unsets or toggles the allowColorOps resource and is also invoked by the

allow-color-ops entry in fontMenu.

allow-font-ops(on/off/toggle)
This action sets, unsets or toggles the allowFontOps resource and is also invoked by the

allow-font-ops entry in fontMenu.

allow-send-events(on/off/toggle)
This action sets, unsets or toggles the allowSendEvents resource and is also invoked by the

allowsends entry in mainMenu.

allow-tcap-ops(on/off/toggle)
This action sets, unsets or toggles the allowTcapOps resource and is also invoked by the

allow-tcap-ops entry in fontMenu.

allow-title-ops(on/off/toggle)
This action sets, unsets or toggles the allowTitleOps resource and is also invoked by the

allow-title-ops entry in fontMenu.

allow-window-ops(on/off/toggle)
This action sets, unsets or toggles the allowWindowOps resource and is also invoked by the

allow-window-ops entry in fontMenu.

alt-sends-escape()
This action toggles the state of the altSendsEscape resource.

bell([percent])
This action rings the keyboard bell at the specified percentage above or below the base

volume.

clear-saved-lines()
This action does hard-reset() and also clears the history of lines saved off the top of the

screen. It is also invoked from the clearsavedlines entry in vtMenu. The effect is identical

to a hardware reset (RIS) control sequence.

copy-selection(destname [, …])
This action puts the currently selected text into all of the selections or cutbuffers

specified by destname. Unlike select-end, it does not send a mouse position or otherwise

modify the internal selection state.

create-menu(m/v/f/t)
This action creates one of the menus used by xterm, if it has not been previously created.

The parameter values are the menu names: mainMenu, vtMenu, fontMenu, tekMenu, respectively.

dabbrev-expand()
Expands the word before cursor by searching in the preceding text on the screen and in the

scrollback buffer for words starting with that abbreviation. Repeating dabbrev-expand()

several times in sequence searches for an alternative expansion by looking farther back. Lack

of more matches is signaled by a bell. Attempts to expand an empty word (i.e., when cursor is

preceded by a space) yield successively all previous words. Consecutive identical expansions

are ignored. The word here is defined as a sequence of non-whitespace characters. This

feature partially emulates the behavior of “dynamic abbreviation” expansion in Emacs (bound

there to M-/). Here is a resource setting for xterm which will do the same thing:

*VT100*translations: #override \n\
Meta <KeyPress> /:dabbrev-expand()

deiconify()
Changes the window state back to normal, if it was iconified.

delete-is-del()
This action toggles the state of the deleteIsDEL resource.

dired-button()
Handles a button event (other than press and release) by echoing the event’s position (i.e.,

character line and column) in the following format:

^X ESC G <line+“ ”> <col+“ ”>

exec-formatted(format, sourcename [, …])
Execute an external command, using the current selection for part of the command’s parameters.

The first parameter, format gives the basic command. Succeeding parameters specify the

selection source as in insert-selection.

The format parameter allows these substitutions:

%% inserts a “%”.

%P the screen-position at the beginning of the highlighted region, as a semicolon-separated
pair of integers using the values that the CUP control sequence would use.

%p the screen-position after the beginning of the highlighted region, using the same
convention as “%P”.

%S the length of the string that “%s” would insert.

%s the content of the selection, unmodified.

%T the length of the string that “%t” would insert.

%t the selection, trimmed of leading/trailing whitespace. Embedded spaces (and newlines)
are copied as is.

%R the length of the string that “%r” would insert.

%r the selection, trimmed of trailing whitespace.

%V the video attributes at the beginning of the highlighted region, as a semicolon-separated
list of integers using the values that the SGR control sequence would use.

%v the video attributes after the end of the highlighted region, using the same convention
as “%V”.

After constructing the command-string, xterm forks a subprocess and executes the command,

which completes independently of xterm.

For example, this translation would invoke a new xterm process to view a file whose name is

selected while holding the shift key down. The new process is started when the mouse button

is released:

*VT100*translations: #override Shift \
<Btn1Up>: exec-formatted(“xterm -e view ‘%t'”, SELECT)

exec-selectable(format, onClicks)
Execute an external command, using data copied from the screen for part of the command’s

parameters. The first parameter, format gives the basic command as in exec-formatted. The

second parameter specifies the method for copying the data as in the on2Clicks resource.

fullscreen(on/off/toggle)
This action sets, unsets or toggles the fullscreen resource.

iconify()
Iconifies the window.

hard-reset()
This action resets the scrolling region, tabs, window size, and cursor keys and clears the

screen. It is also invoked from the hardreset entry in vtMenu.

ignore()
This action ignores the event but checks for special pointer position escape sequences.

insert()
This action inserts the character or string associated with the key that was pressed.

insert-eight-bit()
This action inserts an eight-bit (Meta) version of the character or string associated with the

key that was pressed. Only single-byte values are treated specially. The exact action

depends on the value of the altSendsEscape and the metaSendsEscape and the eightBitInput

resources. The metaSendsEscape resource is tested first. See the eightBitInput resource for

a full discussion.

The term “eight-bit” is misleading: xterm checks if the key is in the range 128 to 255 (the

eighth bit is set). If the value is in that range, depending on the resource values, xterm

may then do one of the following:

· add 128 to the value, setting its eighth bit,

· send an ESC byte before the key, or

· send the key unaltered.

insert-formatted(format, sourcename [, …])
Insert the current selection or data related to it, formatted. The first parameter, format

gives the template for the data as in exec-formatted. Succeeding parameters specify the

selection source as in insert-selection.

insert-selectable(format, onClicks)
Insert data copied from the screen, formatted. The first parameter, format gives the template

for the data as in exec-formatted. The second parameter specifies the method for copying the

data as in the on2Clicks resource.

insert-selection(sourcename [, …])
This action inserts the string found in the selection or cutbuffer indicated by sourcename.

Sources are checked in the order given (case is significant) until one is found. Commonly-

used selections include: PRIMARY, SECONDARY, and CLIPBOARD. Cut buffers are typically named

CUT_BUFFER0 through CUT_BUFFER7.

insert-seven-bit()
This action is a synonym for insert(). The term “seven-bit” is misleading: it only implies

that xterm does not try to add 128 to the key’s value as in insert-eight-bit().

interpret(control-sequence)
Interpret the given control sequence locally, i.e., without passing it to the host. This

works by inserting the control sequence at the front of the input buffer. Use “\” to escape

octal digits in the string. Xt does not allow you to put a null character (i.e., “\000”) in

the string.

keymap(name)
This action dynamically defines a new translation table whose resource name is name with the

suffix “Keymap” (i.e., nameKeymap, where case is significant). The name None restores the

original translation table.

larger-vt-font()
Set the font to the next larger one, based on the font dimensions. See also set-vt-font().

load-vt-fonts(name[,class])
Load fontnames from the given subresource name and class. That is, load the

“*VT100.name.font”, resource as “*VT100.font” etc. If no name is given, the original set of

fontnames is restored.

Unlike set-vt-font(), this does not affect the escape- and select-fonts, since those are not

based on resource values. It does affect the fonts loosely organized under the “Default” menu

entry, including font, boldFont, wideFont and wideBoldFont.

maximize()
Resizes the window to fill the screen.

meta-sends-escape()
This action toggles the state of the metaSendsEscape resource.

popup-menu(menuname)
This action displays the specified popup menu. Valid names (case is significant) include:

mainMenu, vtMenu, fontMenu, and tekMenu.

print(printer-flags)
This action prints the window. It is also invoked by the print entry in mainMenu.

The action accepts optional parameters, which temporarily override resource settings. The

parameter values are matched ignoring case:

noFormFeed
no form feed will be sent at the end of the last line printed (i.e., printerFormFeed is

“false”).

FormFeed
a form feed will be sent at the end of the last line printed (i.e., printerFormFeed is

“true”).

noNewLine
no newline will be sent at the end of the last line printed, and wrapped lines will be

combined into long lines (i.e., printerNewLine is “false”).

NewLine
a newline will be sent at the end of the last line printed, and each line will be limited

(by adding a newline) to the screen width (i.e., printerNewLine is “true”).

noAttrs
the page is printed without attributes (i.e., printAttributes is “0”).

monoAttrs
the page is printed with monochrome (vt220) attributes (i.e., printAttributes is “1”).

colorAttrs
the page is printed with ANSI color attributes (i.e., printAttributes is “2”).

print-everything(printer-flags)
This action sends the entire text history, in addition to the text currently visible, to the

program given in the printerCommand resource. It allows the same optional parameters as the

print action. With a suitable printer command, the action can be used to load the text

history in an editor.

print-immediate()
Sends the text of the current window directly to a file, as specified by the

printFileImmediate, printModeImmediate and printOptsImmediate resources.

print-on-error()
Toggles a flag telling xterm that if it exits with an X error, to send the text of the current

window directly to a file, as specified by the printFileOnXError, printModeOnXError and

printOptsOnXError resources.

print-redir()
This action toggles the printerControlMode between 0 and 2. The corresponding popup menu

entry is useful for switching the printer off if you happen to change your mind after deciding

to print random binary files on the terminal.

quit()
This action sends a SIGHUP to the subprogram and exits. It is also invoked by the quit entry

in mainMenu.

readline-button()
Supports the optional readline feature by echoing repeated cursor forward or backward control

sequences on button release event, to request that the host application update its notion of

the cursor’s position to match the button event.

redraw()
This action redraws the window. It is also invoked by the redraw entry in mainMenu.

restore()
Restores the window to the size before it was last maximized.

scroll-back(count [,units [,mouse] ])
This action scrolls the text window backward so that text that had previously scrolled off the

top of the screen is now visible.

The count argument indicates the number of units (which may be page, halfpage, pixel, or line)

by which to scroll.

An adjustment can be specified for these values by appending a “+” or “-” sign followed by a

number, e.g., page-2 to specify 2 lines less than a page.

If the third parameter mouse is given, the action is ignored when mouse reporting is enabled.

scroll-forw(count [,units [,mouse] ])
This action is similar to scroll-back except that it scrolls in the other direction.

secure()
This action toggles the Secure Keyboard mode (see SECURITY), and is invoked from the securekbd

entry in mainMenu.

scroll-lock(on/off/toggle)
This action sets, unsets or toggles internal state which tells xterm whether Scroll Lock is

active, subject to the allowScrollLock resource.

select-cursor-end(destname [, …])
This action is similar to select-end except that it should be used with select-cursor-start.

select-cursor-extend()
This action is similar to select-extend except that it should be used with select-cursor-

start.

select-cursor-start()
This action is similar to select-start except that it begins the selection at the current text

cursor position.

select-end(destname [, …])
This action puts the currently selected text into all of the selections or cutbuffers

specified by destname. It also sends a mouse position and updates the internal selection

state to reflect the end of the selection process.

select-extend()
This action tracks the pointer and extends the selection. It should only be bound to Motion

events.

select-set()
This action stores text that corresponds to the current selection, without affecting the

selection mode.

select-start()
This action begins text selection at the current pointer location. See the section on POINTER

USAGE for information on making selections.

send-signal(signame)
This action sends the signal named by signame to the xterm subprocess (the shell or program

specified with the -e command line option). It is also invoked by the suspend, continue,

interrupt, hangup, terminate, and kill entries in mainMenu. Allowable signal names are (case

is not significant): tstp (if supported by the operating system), suspend (same as tstp), cont

(if supported by the operating system), int, hup, term, quit, alrm, alarm (same as alrm) and

kill.

set-8-bit-control(on/off/toggle)
This action sets, unsets or toggles the eightBitControl resource. It is also invoked from the

8-bit-control entry in vtMenu.

set-allow132(on/off/toggle)
This action sets, unsets or toggles the c132 resource. It is also invoked from the allow132

entry in vtMenu.

set-altscreen(on/off/toggle)
This action sets, unsets or toggles between the alternate and current screens.

set-appcursor(on/off/toggle)
This action sets, unsets or toggles the handling Application Cursor Key mode and is also

invoked by the appcursor entry in vtMenu.

set-appkeypad(on/off/toggle)
This action sets, unsets or toggles the handling of Application Keypad mode and is also

invoked by the appkeypad entry in vtMenu.

set-autolinefeed(on/off/toggle)
This action sets, unsets or toggles automatic insertion of linefeeds. It is also invoked by

the autolinefeed entry in vtMenu.

set-autowrap(on/off/toggle)
This action sets, unsets or toggles automatic wrapping of long lines. It is also invoked by

the autowrap entry in vtMenu.

set-backarrow(on/off/toggle)
This action sets, unsets or toggles the backarrowKey resource. It is also invoked from the

backarrow key entry in vtMenu.

set-bellIsUrgent(on/off/toggle)
This action sets, unsets or toggles the bellIsUrgent resource. It is also invoked by the

bellIsUrgent entry in vtMenu.

set-cursorblink(on/off/toggle)
This action sets, unsets or toggles the cursorBlink resource. It is also invoked from the

cursorblink entry in vtMenu.

set-cursesemul(on/off/toggle)
This action sets, unsets or toggles the curses resource. It is also invoked from the

cursesemul entry in vtMenu.

set-font-doublesize(on/off/toggle)
This action sets, unsets or toggles the fontDoublesize resource. It is also invoked by the

font-doublesize entry in fontMenu.

set-hp-function-keys(on/off/toggle)
This action sets, unsets or toggles the hpFunctionKeys resource. It is also invoked by the

hpFunctionKeys entry in mainMenu.

set-jumpscroll(on/off/toggle)
This action sets, unsets or toggles the jumpscroll resource. It is also invoked by the

jumpscroll entry in vtMenu.

set-font-linedrawing(on/off/toggle)
This action sets, unsets or toggles the xterm’s state regarding whether the current font has

line-drawing characters and whether it should draw them directly. It is also invoked by the

font-linedrawing entry in fontMenu.

set-font-packed(on/off/toggle)
This action sets, unsets or toggles the forcePackedFont resource which controls use of the

font’s minimum or maximum glyph width. It is also invoked by the font-packed entry in

fontMenu.

set-keep-clipboard(on/off/toggle)
This action sets, unsets or toggles the keepClipboard resource.

set-keep-selection(on/off/toggle)
This action sets, unsets or toggles the keepSelection resource. It is also invoked by the

keepSelection entry in vtMenu.

set-logging(on/off/toggle)
This action sets, unsets or toggles the state of the logging option.

set-old-function-keys(on/off/toggle)
This action sets, unsets or toggles the state of legacy function keys. It is also invoked by

the oldFunctionKeys entry in mainMenu.

set-marginbell(on/off/toggle)
This action sets, unsets or toggles the marginBell resource.

set-num-lock(on/off/toggle)
This action toggles the state of the numLock resource.

set-pop-on-bell(on/off/toggle)
This action sets, unsets or toggles the popOnBell resource. It is also invoked by the

poponbell entry in vtMenu.

set-private-colors(on/off/toggle)
This action sets, unsets or toggles the privateColorRegisters resource.

set-render-font(on/off/toggle)
This action sets, unsets or toggles the renderFont resource. It is also invoked by the

render-font entry in fontMenu.

set-reverse-video(on/off/toggle)
This action sets, unsets or toggles the reverseVideo resource. It is also invoked by the

reversevideo entry in vtMenu.

set-reversewrap(on/off/toggle)
This action sets, unsets or toggles the reverseWrap resource. It is also invoked by the

reversewrap entry in vtMenu.

set-scroll-on-key(on/off/toggle)
This action sets, unsets or toggles the scrollKey resource. It is also invoked from the

scrollkey entry in vtMenu.

set-scroll-on-tty-output(on/off/toggle)
This action sets, unsets or toggles the scrollTtyOutput resource. It is also invoked from the

scrollttyoutput entry in vtMenu.

set-scrollbar(on/off/toggle)
This action sets, unsets or toggles the scrollbar resource. It is also invoked by the

scrollbar entry in vtMenu.

set-sco-function-keys(on/off/toggle)
This action sets, unsets or toggles the scoFunctionKeys resource. It is also invoked by the

scoFunctionKeys entry in mainMenu.

set-select(on/off/toggle)
This action sets, unsets or toggles the selectToClipboard resource. It is also invoked by the

selectToClipboard entry in vtMenu.

set-sixel-scrolling(on/off/toggle)
This action toggles between inline (sixel scrolling) and absolute positioning. It can also be

controlled via DEC private mode 80 (DECSDM) or from the sixelScrolling entry in the btMenu.

set-sun-function-keys(on/off/toggle)
This action sets, unsets or toggles the sunFunctionKeys resource. It is also invoked by the

sunFunctionKeys entry in mainMenu.

set-sun-keyboard(on/off/toggle)
This action sets, unsets or toggles the sunKeyboard resource. It is also invoked by the

sunKeyboard entry in mainMenu.

set-tek-text(large/2/3/small)
This action sets the font used in the Tektronix window to the value of the selected resource

according to the argument. The argument can be either a keyword or single-letter alias, as

shown in parentheses:

large (l)
Use resource fontLarge, same as menu entry tektextlarge.

two (2)
Use resource font2, same as menu entry tektext2.

three (3)
Use resource font3, same as menu entry tektext3.

small (s)
Use resource fontSmall, same as menu entry tektextsmall.

set-terminal-type(type)
This action directs output to either the vt or tek windows, according to the type string. It

is also invoked by the tekmode entry in vtMenu and the vtmode entry in tekMenu.

set-titeInhibit(on/off/toggle)
This action sets, unsets or toggles the titeInhibit resource, which controls switching between

the alternate and current screens.

set-toolbar(on/off/toggle)
This action sets, unsets or toggles the toolbar feature. It is also invoked by the toolbar

entry in mainMenu.

set-utf8-fonts(on/off/toggle)
This action sets, unsets or toggles the utf8Fonts resource. It is also invoked by the

utf8-fonts entry in fontMenu.

set-utf8-mode(on/off/toggle)
This action sets, unsets or toggles the utf8 resource. It is also invoked by the utf8-mode

entry in fontMenu.

set-utf8-title(on/off/toggle)
This action sets, unsets or toggles the utf8Title resource. It is also invoked by the

utf8-title entry in fontMenu.

set-visibility(vt/tek,on/off/toggle)
This action sets, unsets or toggles whether or not the vt or tek windows are visible. It is

also invoked from the tekshow and vthide entries in vtMenu and the vtshow and tekhide entries

in tekMenu.

set-visual-bell(on/off/toggle)
This action sets, unsets or toggles the visualBell resource. It is also invoked by the

visualbell entry in vtMenu.

set-vt-font(d/1/2/3/4/5/6/e/s [,normalfont [, boldfont]])
This action sets the font or fonts currently being used in the VTxxx window. The first

argument is a single character that specifies the font to be used:

d or D indicate the default font (the font initially used when xterm was started),

1 through 6 indicate the fonts specified by the font1 through font6 resources,

e or E indicate the normal and bold fonts that have been set through escape codes (or
specified as the second and third action arguments, respectively), and

s or S indicate the font selection (as made by programs such as xfontsel(1)) indicated by the
second action argument.

If xterm is configured to support wide characters, an additional two optional parameters are

recognized for the e argument: wide font and wide bold font.

smaller-vt-font()
Set the font to the next smaller one, based on the font dimensions. See also set-vt-font().

soft-reset()
This action resets the scrolling region. It is also invoked from the softreset entry in

vtMenu. The effect is identical to a soft reset (DECSTR) control sequence.

spawn-new-terminal(params)
Spawn a new xterm process. This is available on systems which have a modern version of the

process filesystem, e.g., “/proc”, which xterm can read.

Use the “cwd” process entry, e.g., /proc/12345/cwd to obtain the working directory of the

process which is running in the current xterm.

On systems which have the “exe” process entry, e.g., /proc/12345/exe, use this to obtain the

actual executable. Otherwise, use the $PATH variable to find xterm.

If parameters are given in the action, pass them to the new xterm process.

start-extend()
This action is similar to select-start except that the selection is extended to the current

pointer location.

start-cursor-extend()
This action is similar to select-extend except that the selection is extended to the current

text cursor position.

string(string)
This action inserts the specified text string as if it had been typed. Quotation is necessary

if the string contains whitespace or non-alphanumeric characters. If the string argument

begins with the characters “0x”, it is interpreted as a hex character constant.

tek-copy()
This action copies the escape codes used to generate the current window contents to a file in

the current directory beginning with the name COPY. It is also invoked from the tekcopy entry

in tekMenu.

tek-page()
This action clears the Tektronix window. It is also invoked by the tekpage entry in tekMenu.

tek-reset()
This action resets the Tektronix window. It is also invoked by the tekreset entry in tekMenu.

vi-button()
Handles a button event (other than press and release) by echoing a control sequence computed

from the event’s line number in the screen relative to the current line:

ESC ^P
or
ESC ^N

according to whether the event is before, or after the current line, respectively. The ^N (or

^P) is repeated once for each line that the event differs from the current line. The control

sequence is omitted altogether if the button event is on the current line.

visual-bell()
This action flashes the window quickly.

The Tektronix window also has the following action:

gin-press(l/L/m/M/r/R)
This action sends the indicated graphics input code.

默认的快捷键绑定

The default bindings in the VTxxx window use the SELECT token, which is set by the selectToClipboard

resource. These are for the vt100 widget:

Shift <KeyPress> Prior:scroll-back(1,halfpage) \n\

Shift <KeyPress> Next:scroll-forw(1,halfpage) \n\

Shift <KeyPress> Select:select-cursor-start() \
select-cursor-end(SELECT, CUT_BUFFER0) \n\
Shift <KeyPress> Insert:insert-selection(SELECT, CUT_BUFFER0) \n\
Alt <Key>Return:fullscreen() \n\
<KeyRelease> Scroll_Lock:scroll-lock() \n\
Shift~Ctrl <KeyPress> KP_Add:larger-vt-font() \n\

Shift Ctrl <KeyPress> KP_Add:smaller-vt-font() \n\

Shift <KeyPress> KP_Subtract:smaller-vt-font() \n\
~Meta <KeyPress>:insert-seven-bit() \n\
Meta <KeyPress>:insert-eight-bit() \n\
!Ctrl <Btn1Down>:popup-menu(mainMenu) \n\
!Lock Ctrl <Btn1Down>:popup-menu(mainMenu) \n\
!Lock Ctrl
@Num_Lock <Btn1Down>:popup-menu(mainMenu) \n\
!
@Num_Lock Ctrl <Btn1Down>:popup-menu(mainMenu) \n\
~Meta <Btn1Down>:select-start() \n\

~Meta <Btn1Motion>:select-extend() \n\

!Ctrl <Btn2Down>:popup-menu(vtMenu) \n\
!Lock Ctrl <Btn2Down>:popup-menu(vtMenu) \n\
!Lock Ctrl
@Num_Lock <Btn2Down>:popup-menu(vtMenu) \n\
!
@Num_Lock Ctrl <Btn2Down>:popup-menu(vtMenu) \n\
~Ctrl ~Meta <Btn2Down>:ignore() \n\
Meta <Btn2Down>:clear-saved-lines() \n\
~Ctrl ~Meta <Btn2Up>:insert-selection(SELECT, CUT_BUFFER0) \n\
!Ctrl <Btn3Down>:popup-menu(fontMenu) \n\
!Lock Ctrl <Btn3Down>:popup-menu(fontMenu) \n\
!Lock Ctrl
@Num_Lock <Btn3Down>:popup-menu(fontMenu) \n\
!
@Num_Lock Ctrl <Btn3Down>:popup-menu(fontMenu) \n\
~Ctrl ~Meta <Btn3Down>:start-extend() \n\
~Meta <Btn3Motion>:select-extend() \n\
Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\
Lock Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\
Lock
@Num_Lock Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\
@Num_Lock Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\
<Btn4Down>:scroll-back(5,line,m) \n\
Ctrl <Btn5Down>:scroll-forw(1,halfpage,m) \n\
Lock Ctrl <Btn5Down>:scroll-forw(1,halfpage,m) \n\
Lock
@Num_Lock Ctrl <Btn5Down>:scroll-forw(1,halfpage,m) \n\
@Num_Lock Ctrl <Btn5Down>:scroll-forw(1,halfpage,m) \n\
<Btn5Down>:scroll-forw(5,line,m) \n\
<BtnUp>:select-end(SELECT, CUT_BUFFER0) \n\
<BtnDown>:ignore()

The default bindings in the Tektronix window are analogous but less extensive. These are for the

tek4014 widget:

~Meta<KeyPress>: insert-seven-bit() \n\

Meta<KeyPress>: insert-eight-bit() \n\
!Ctrl <Btn1Down>: popup-menu(mainMenu) \n\
!Lock Ctrl <Btn1Down>: popup-menu(mainMenu) \n\
!Lock Ctrl
@Num_Lock <Btn1Down>: popup-menu(mainMenu) \n\
!Ctrl
@Num_Lock <Btn1Down>: popup-menu(mainMenu) \n\
!Ctrl <Btn2Down>: popup-menu(tekMenu) \n\
!Lock Ctrl <Btn2Down>: popup-menu(tekMenu) \n\
!Lock Ctrl
@Num_Lock <Btn2Down>: popup-menu(tekMenu) \n\
!Ctrl
@Num_Lock <Btn2Down>: popup-menu(tekMenu) \n\
Shift ~Meta<Btn1Down>: gin-press(L) \n\
~Meta<Btn1Down>: gin-press(l) \n\
Shift ~Meta<Btn2Down>: gin-press(M) \n\
~Meta<Btn2Down>: gin-press(m) \n\
Shift ~Meta<Btn3Down>: gin-press(R) \n\
~Meta<Btn3Down>: gin-press(r)

Here is an example which uses shifted select/paste to copy to the clipboard, and unshifted

select/paste for the primary selection. In each case, a (different) cut buffer is also a target or

source of the select/paste operation. It is important to remember however, that cut buffers store

data in ISO-8859-1 encoding, while selections can store data in a variety of formats and encodings.

While xterm owns the selection, it highlights it. When it loses the selection, it removes the

corresponding highlight. But you can still paste from the corresponding cut buffer.

*VT100*translations: #override \n\
~Shift~Ctrl<Btn2Up>: insert-selection(PRIMARY, CUT_BUFFER0) \n\

Shift~Ctrl<Btn2Up>: insert-selection(CLIPBOARD, CUT_BUFFER1) \n\

~Shift<BtnUp>: select-end(PRIMARY, CUT_BUFFER0) \n\

Shift<BtnUp>: select-end(CLIPBOARD, CUT_BUFFER1)

In the example, the class name VT100 is used rather than the widget name. These are different; the

class name provides a more-specific match than the widget name. A leading “*” is used because the

widget hierarchy above the vt100 widget depends on whether the toolbar support is compiled into xterm.

Below is shown a sample of how the keymap() action may be used to add special keys for entering

commonly-typed words:

*VT100.Translations: #override <Key>F13: keymap(dbx)

*VT100.dbxKeymap.translations: \
<Key>F14: keymap(None) \n\

<Key>F17: string(“next”) string(0x0d) \n\

<Key>F18: string(“step”) string(0x0d) \n\

<Key>F19: string(“continue”) string(0x0d) \n\

<Key>F20: string(“print “) insert-selection(PRIMARY, CUT_BUFFER0)

默认的滚动条绑定

Key bindings are normally associated with the vt100 or tek4014 widgets which act as terminal

emulators. Xterm’s scrollbar (and toolbar if it is configured) are separate widgets. Because all of

these use the X Toolkit, they have corresponding translations resources. Those resources are

distinct, and match different patterns, e.g., the differences in widget-name and number of levels of

widgets which they may contain.

The scrollbar widget is a child of the vt100 widget. It is positioned on top of the vt100 widget.

Toggling the scrollbar on and off causes the vt100 widget to resize.

The default bindings for the scrollbar widget use only mouse-button events:

<Btn5Down>: StartScroll(Forward) \n\

<Btn1Down>: StartScroll(Forward) \n\

<Btn2Down>: StartScroll(Continuous) MoveThumb() NotifyThumb() \n\

<Btn3Down>: StartScroll(Backward) \n\

<Btn4Down>: StartScroll(Backward) \n\

<Btn2Motion>: MoveThumb() NotifyThumb() \n\

<BtnUp>: NotifyScroll(Proportional) EndScroll()

Events which the scrollbar widget does not recognize at all are lost.

However, at startup, xterm augments these translations with the default translations used for the

vt100 widget, together with the resource “actions” which those translations use. Because the

scrollbar (or menubar) widgets do not recognize these actions (but because it has a corresponding

translation), they are passed on to the vt100 widget.

This augmenting of the scrollbar’s translations has a few limitations:

· Xterm knows what the default translations are, but there is no suitable library interface for
determining what customizations a user may have added to the vt100 widget. All that xterm can do

is augment the scrollbar widget to give it the same starting point for further customization by

the user.

· Events in the gap between the widgets may be lost.

· Compose sequences begun in one widget cannot be completed in the other, because the input methods
for each widget do not share context information.

Most customizations of the scrollbar translations do not concern key bindings. Rather, users are

generally more interested in changing the bindings of the mouse buttons. For example, some people

prefer using the left pointer button for dragging the scrollbar thumb. That can be set up by altering

the translations resource, e.g.,

*VT100.scrollbar.translations: #override \n\
<Btn5Down>: StartScroll(Forward) \n\

<Btn1Down>: StartScroll(Continuous) MoveThumb() NotifyThumb() \n\

<Btn4Down>: StartScroll(Backward) \n\

<Btn1Motion>: MoveThumb() NotifyThumb() \n\

<BtnUp>: NotifyScroll(Proportional) EndScroll()