Skip to content

Manual §3 Key Binding

Koichi Murase edited this page Jul 10, 2024 · 29 revisions

[ 日本語 | English ] ≫ Manual [§1 Intro | §2 Color | §3 Bind | §4 Edit | §5 Emacs | §6 Vim | §7 Comp | §8 Misc | Index]

3. Key Binding

3.1 Key specifier (kspec) / Keyseq specifier (kspecs)

In ble.sh, received "byte sequences" of user inputs are decoded into "character sequences", and then they are decoded into "key sequences". Key specifier (kspec) is a common text representation of a byte, a character or a key. The key specifier has the form with a key name (keyname) preceded by zero or more modifiers such as C- and M-. The modifiers have the form "(a character) + -". The available modifiers are listed in the following table.

Modifier spec Modifier key
S- Shift key
C- Control key
M- Meta key
A- Alter key
s- Super key
H- Hyper key

Note that Alter, Super and Hyper modifiers are usually not used because most terminals does not support them. Even if the keyboard has an alter key, usually it is treated as a Meta key by terminals.

keyname is a non-empty string composed of non-space characters that represents a character input or a key input. When keyname is a single character, it represents the input of that character. For example, C-M-- represents the input "Control + Meta + -". When keyname has the form U+hhhh where h is a hexadeicimal digit, it specifies a character by Unicode. When keyname is a string with more than one character, it represents a special character, a control character or a function key.

The following table shows keynames for special characters.

keyname Char code keyname Char code
SP 32 (space) DEL 127

keynames for C0 control characters are summarized in the following table. HT and CR are treated as aliases of TAB and RET, respectively. These control characters (originally received as characters) are converted to keys C-@, C-a...C-z, C-[, C-\, C-], C-^, C-_ during decoding to key sequences, so normally they cannot appear directly in key sequences.

keyname Char code keyname Char code
NUL 0 DLE 16
SOH 1 DC1 17
STX 2 DC2 18
ETX 3 DC3 19
EOT 4 DC4 20
ENQ 5 NAK 21
ACK 6 SYN 22
BEL 7 ETB 23
BS 8 CAN 24
HT, TAB 9 EM 25
LF 10 SUB 26
VT 11 ESC 27
FF 12 FS 28
CR, RET 13 GS 29
SO 14 RS 30
SI 15 US 31

keynames for C1 control characters are shown below.

keyname Char code keyname Char code
PAD 128 DCS 144
HOP 129 PU1 145
BPH 130 PU2 146
NBH 131 STS 147
IND 132 CCH 148
NEL 133 MW 149
SSA 134 SPA 150
ESA 135 EPA 151
HTS 136 SOS 152
HTJ 137 SGCI 153
VTS 138 SCI 154
PLD 139 CSI 155
PLU 140 ST 156
RI 141 OSC 157
SS2 142 PM 158
SS3 143 APC 159

keynames which represent the modifier keys themselves are shown in the following table.

keyname Description
shift Shift key
control Control key
meta Meta key
alter Alter key
super Super key
hyper Hyper key

keynames which represent other function keys are listed in the following table.

keyname Description
insert Insert key
delete Delete key
home Home key
end End key
prior PageUp key
next PageDown key
up ↑ (Up) key
down ↓ (Down) key
left ← (Left) key
right → (Right) key
f1-f20 Function key
paste_begin Bracketed Paste Mode Begin
paste_end Bracketed Paste Mode End

keynames for the special keys internally used in ble.sh is shown in the following table.

keyname Description
__defchar__ (See the section of Keymap)
__default__ (See the section of Keymap)
__batch_char__ (See the section of Keymap)
__before_widget__ (See the section of Keymap)
__after_widget__ (See the section of Keymap)
__attach__ (See the section of Keymap)
__detach__ (See the section of Keymap)
__ignore__ (Internal) Already processed. Ignored later
__error__ (Internal) Unrecognized CSI sequences
@ESC (Internal) Character to represent isolated ESC
@NUL (Internal) Character for encoding NUL

Key sequence specifier (kspecs) is a string that represents a sequence of key inputs. The keyseq specifier contains one or more key specifiers (kspec) separated by spaces. For example, the kspecs "C-x C-r" means the inputs of "Control + x followed by Control + r".

3.1.1 Representation of RET, ESC, TAB, BS, DEL, and C-BS

As already mentioned, in terminal-to-host communication, control characters are used to represent keys with Control modifier (C-@, C-a...C-z, C-[, C-\, C-], C-^, C-_). For this reason, the keys in the user keyboard related to control characters are transmitted as different keys with the Control modifier. When the terminal supports modifyOtherKeys mode and it is enabled, these keys may be transmitted as the original control character. The following table summarizes such keys. Note that the actual bytes transmitted may be different depending on your terminal.

Key Usually transmitted as In modifyOtherKeys mode
Return, Enter C-m RET
Tab C-i TAB
Escape C-[ ESC
Backspace, DEL C-? (or C-h) BS, DEL
C-Backspace, C-DEL C-h (or C-?, C-_, C-w) C-BS, C-DEL

In particular, Backspace and C-Backspace largely depend on the terminal you use. Here is the summary of the escape codes for Backspace and C-Backspace in different terminals:

Backspace C-Backspace Terminal
C-? C-h Linux console, mintty, xterm, konsole, terminator, cygwin (pcon), Windows terminal, rxvt, urxvt, GNOME Terminal, alacritty, kitty
C-? C-? FreeBSD console, lxterminal, termit
C-? C-w VSCode Terminal
C-? C-_ contra
C-h C-h Solaris console, terminology, RLogin
C-h C-? Minix console, Poderosa

For these keys, it is recommended to bind widgets to both representations.

# Examples

ble-bind -m emacs -f 'C-m' accept-single-line-or-newline
ble-bind -m emacs -f 'RET' accept-single-line-or-newline

ble-bind -m vi_imap -f 'C-i' 'vi_imap/complete'
ble-bind -m vi_imap -f 'TAB' 'vi_imap/complete'

ble-bind -m vi_imap -f 'ESC' 'vi_imap/normal-mode'
ble-bind -m vi_imap -f 'C-[' 'vi_imap/normal-mode'

# Backspace
ble-bind -m emacs -f 'C-?' 'delete-region-or delete-backward-char'
ble-bind -m emacs -f 'DEL' 'delete-region-or delete-backward-char'
ble-bind -m emacs -f 'C-h' 'delete-region-or delete-backward-char'
ble-bind -m emacs -f 'BS'  'delete-region-or delete-backward-char'

# Control-Backspace (for typical modern terminals)
ble-bind -m emacs -f 'C-h'   'emacs/undo'
ble-bind -m emacs -f 'C-DEL' 'emacs/undo'
ble-bind -m emacs -f 'C-BS'  'emacs/undo'

# Control Backspace (FreeBSD console, Minix console, lxterminal, termit, Poderosa)
ble-bind -m emacs -f 'C-?'   'emacs/undo'
ble-bind -m emacs -f 'C-DEL' 'emacs/undo'
ble-bind -m emacs -f 'C-BS'  'emacs/undo'

# Control Backspace (VSCode terminal)
ble-bind -m emacs -f 'C-w'   'emacs/undo'
ble-bind -m emacs -f 'C-DEL' 'emacs/undo'
ble-bind -m emacs -f 'C-BS'  'emacs/undo'

# Control Backspace (contra)
ble-bind -m emacs -f 'C-_'   'emacs/undo'
ble-bind -m emacs -f 'C-DEL' 'emacs/undo'
ble-bind -m emacs -f 'C-BS'  'emacs/undo'

For Escape (C-[/ESC), one should also check §3.5.

3.2 Widget (widget)

In ble.sh, every user inputs are eventually handled by executing corresponding widgets. Each widget has a name and implemented as a shell function ble/widget/WidgetName where WidgetName is the name of the widget. Each widget will be explained in related sections. If you want to design your own widgets, please see also "Design widgets".

3.3 Keymap (keymap)

Keymap is a dictionary containing the mapping from a key sequence (kspecs) to a widget which should be called for that key sequence. Each mode has a corresponding keymap. Each keymap has a name which has the form of C identifier. In the following table, basic keymaps are listed.

Keymap name Description Load hook
emacs (Emacs editing mode) Base keymap hook:keymap_emacs_load
vi_imap (Vim editing mode) Base keymap (Insert mode) hook:keymap_vi_load
vi_nmap (Vim editing mode) Normal mode keymap hook:keymap_vi_load
vi_omap (Vim editing mode) Operator-pending mode keymap hook:keymap_vi_load
vi_xmap (Vim editing mode) Visual mode keymap hook:keymap_vi_load
vi_smap (Vim editing mode) Select mode keymap hook:keymap_vi_load
vi_cmap (Vim editing mode) Command-line mode keymap hook:keymap_vi_load
vi_digraph (Vim editing mode) Keymap for digraph input hook:keymap_vi_load
safe Base keymap for emergency
isearch Keymap for incremental search
nsearch Keymap for non-incremental search
read Keymap for read -e implemented by ble.sh
lastarg Keymap for insert-last-argument
auto_complete Keymap for auto-complete hook:complete_load
menu_complete Keymap for menu-complete hook:complete_load
dabbrev Keymap for dabbrev expansion hook:complete_load

The load of the keymaps for which load hooks are specified are delayed. The modifications to such a keymap (by ble-bind in the next section) are also automatically delayed. (In ble-0.3 and before, the delayed modification is not supported. Any modification causes the initialization of keymaps.) The modifications to keymaps can be either made directly or made through load hooks.

# Example 1: Bind directly

ble-bind -m vi_imap -f 'C-^' 'bell'
ble-bind -m vi_omap -f 'a' 'vi-command/text-object-outer'


# Example 2: Bind through load hook

# Prepare a shell function to configure Vim editing mode
function my-keymap-settings-for-vim-mode {
  ble-bind -m vi_imap -f 'C-^' 'bell'
  ble-bind -m vi_omap -f 'a' 'vi-command/text-object-outer'
}

# Register the function to the hook "keymap_vi_load"
blehook/eval-after-load keymap_vi my-keymap-settings-for-vim-mode
# ble-0.3 or before
# ble/array#push _ble_keymap_vi_load_hook my-keymap-settings-for-vim-mode

The following special kspecs, which are generated for special situations, are also available.

keyname Situation in which the key is triggered
__defchar__ When ble.sh received a unbounded character input
__default__ When ble.sh received a unbounded key/character input
__batch_char__ When ble.sh received many unbounded character inputs
__before_widget__ Before a widget is called for the keymap
__after_widget__ After a widget is called for the keymap
__attach__ When the keymap becomes the base keymap
__detach__ When the keymap becomes not the base keymap

Note that when unbounded character is processed by __defchar__, __default__ will not be triggered by that character. __before_widget__ and __after_widget__ will not be generated before/after the widgets invoked through __before_widget__ and __after_widget__.

3.4 Function ble-bind

3.4.1 Bind key sequences to widgets

ble-bind [-m KEYMAP] -f KSPECS WIDGET

The function binds KSPECS to WIDGET, i.e., registers the WIDGET as the widget to be called when the kspecs KSPECS is received. KEYMAP specifies a keymap in which the binding is registered. If KEYMAP is omitted, the base keymap for the current editing mode will be used.

3.4.2 Bind key sequences to user-defined editing functions

ble-bind [-m KEYMAP] -x KSPECS SHELL-COMMAND

# Use the following form for ble-0.2 and before
ble-bind [-m KEYMAP] -xf KSPECS SHELL-COMMAND   # ble-0.2

This binds KSPECS to a user-defined editing function SHELL-COMMAND. The user-defined editing function can be implemented just in the same way for Bash's bash -x 'kseq: SHELL-COMMAND'. ble.sh sets the current editing string to READLINE_LINE and the current cursor point (in the character numbers) to READLINE_POINT, before executing SHELL-COMMAND. The current line will be updated using READLINE_LINE and READLINE_POINT after the execution of SHELL-COMMAND

3.4.3 Bind key sequences to commands

ble-bind [-m KEYMAP] -c KSPECS SHELL-COMMAND

# Use the following form for ble-0.2 and before
ble-bind [-m KEYMAP] -cf KSPECS SHELL-COMMAND   # ble-0.2

This binds KSPECS to an external command SHELL-COMMAND. The editing is temporarily stopped, and SHELL-COMMAND is executed. After the execution, the editing is resumed with the original state.

3.4.4 Bind key sequences to keyboard macros (v0.3)

# ble-0.3 and later
ble-bind [-m KEYMAP] -s KSPECS KEYSEQ

This binds KSPECS to a keyboard macro KEYSEQ specified with the form used in the keyseq for the Bash builtin bind.

3.4.5 Removing binding

ble-bind [-m KEYMAP] [-fxc] KSPECS ''
ble-bind [-m KEYMAP] [-fxc] KSPECS -

When an empty string or - is specified as a widget or a command, the binding is removed. Regardless of the specified type of the binding -f, -x and -c, any type of the existing binding is removed.

3.4.6 Set timeouts

# Set timeout
ble-bind [-m KEYMAP] -T KSPECS TIMEOUT

# Remove timeout
ble-bind [-m KEYMAP] -T KSPECS ''

This sets a timeout for the specified KSPECS. When ble.sh receives the sequence KSPECS for which a timeout is set and the binding is not complete nor uniquely determined, if there is no subsequent inputs within the timeout, KSPECS are processed without waiting the succeeding inputs.

3.4.7 Register CSI sequences of keys

This setting is used when the character sequences are decoded into the key sequences.

ble-bind --csi Ft KSPEC
ble-bind --csi Ps~ KSPEC

Ft or Ps~ specifies a string which will be received after CSI. Ft is a Ft character (in the range @...~). Ps~ is a integer parameter Ps followed by a tilde ~. The specified CSI sequence and its variants with Function-key modifications are bound to KSPEC and its variants with modifiers, respectively.

# Example
ble-bind --csi A up
ble-bind --csi '11~' f1

3.4.8 Register byte sequences for keys

This setting is used when the character sequences are decoded into the key sequences.

ble-bind -k KSPECS KSPEC

This makes the character sequence KSPECS be decoded to a key KSPEC.

# Example
ble-bind -k 'ESC O A' up

3.4.9 Set the cursor state for the keymap

This provides the configuration of the cursor state (shape and blinking state) used when the keymap is active.

ble-bind -m KEYMAP --cursor CODE

CODE is a DECSCUSR code. An empty value means that the cursor shape is inherited from the caller keymap.

The terminal needs to support the terminal control function DECSCUSR. ble.sh references the terminfo entry of Ss. If your terminal actually supports DECSCR yet the terminal entry Ss is not specified in terminfo, you can directly override the terminal database of ble.sh as

# Example: in blerc

_ble_term_Ss=$'\e[@1 q'

The value 0 means the default cursor style of the terminal. When a terminal multiplexer is used, the default cursor style of the terminal multiplexer (if any) and the outer terminal needs to be consistent. For example, tmux manages its own default cursor style, which can be different from that of the outer terminal. The default cursor style of tmux is blinking block 1 the same as the VT terminals. From tmux-3.4, the default cursor style can be changed through the tmux option cursor-style:

# in ~/.tmux.conf (requires tmux >= 3.4)

# Example
set -g cursor-style blinking-block     # when 1 is the default of the outer terminal
set -g cursor-style block              # when 2 is the default of the outer terminal
set -g cursor-style blinking-underline # when 3 is the default of the outer terminal
set -g cursor-style underline          # when 4 is the default of the outer terminal
set -g cursor-style blinking-bar       # when 5 is the default of the outer terminal
set -g cursor-style bar                # when 6 is the default of the outer terminal

Note that the option cursor-style is added in tmux-3.3, but there is a bug that the default cursor style is not applied to the new window. To make it work, tmux-3.4 is at least needed. Also, set -g cursor-style default does not work to send DECSCUSR(0) for the default of the outer terminal. GNU screen does not manage its own cursor style, so there is no problem with GNU screen.

3.4.10 Show current bindings

ble-bind [-m KEYMAP]... -P        # ble-0.3 and later
ble-bind [-m KEYMAP]... --print   # ble-0.3 and later

# Use the following form for ble-0.2 and before
ble-bind -d   # ble-0.2 and before

This prints the list of bindings currently registered to the keymaps specified by -m KEYMAP. When no KEYMAP is specified, it prints the bindings for all the keymaps currently loaded.

3.4.11 Dump current bindings with the internal format

ble-bind [-m KEYMAP]... -D
ble-bind [-m KEYMAP]... --dump   # ble-0.3 and later

When -D is used instead of -P, it prints the current bindings in the internal format. When keymaps is specified, the data for the keymaps is output. When no keymaps is specified, all the data currently loaded is output.

3.4.12 List available widgets

ble-bind -L
ble-bind --list-widgets     # ble-0.3 and later

# Use the following form for ble-0.2 and before
ble-bind -L
ble-bind --list-functions   # ble-0.2 and before

This prints the list of the names of the currently available widgets.

3.5 Reception and interpretation of ESC

When ble.sh received ESC, the ESC is regarded as "isolated ESC" if the next byte is not arrived within the timeout, or otherwise it is regarded as "modifier ESC".

The modifier ESC is always treated as the Meta modifier to the next key, i.e., M-. The treatment of the isolated ESC is determined by the bleopt setting decode_isolated_esc described later.

The effective timeout is the accumulation of timeouts in each step of the route from the terminal to the shell. The possible timeouts include the timeouts of pseudo-terminal handler, terminal multiplexer, and GNU Readline. The setting of each timeout is described in the subsequent sections. If you want to distinguish the direct key input of ESC or C-[ from ESC generated by the Meta key, the timeout should be as short as possible but not zero.

3.5.1 Timeout of pseudo terminal handler (stty)

The command stty can be used to configure the timeout of pseudo-terminal handler. Normally the timeout is 0 by default, so the special setting is not needed. The timeout can be changed by the following command. The unit is 1/10 second.

# Example: in ~/.bashrc or ~/.blerc

stty time 0

3.5.2 Timeout of GNU Readline (bind)

In Bash 4.3 and later, a readline variable keyseq-timeout is available for setting the timeout of Readline. To configure in ~/.bashrc, the builtin command bind can be used as follows. The unit is millisecond.

# Example: in ~/.bashrc or ~/.blerc

bind 'set keyseq-timeout 1'

3.5.3 Timeout of the terminal multiplexer GNU Screen (~/.screenrc)

When the terminal multiplexer GNU Screen (screen) is in use, the timeout of screen should also be configured properly. The timeout can be specified in ~/.screenrc as follows. The unit is millisecond.

# Example: in ~/.screenrc

maptimeout 1

Note that the timeout is disabled when there are GNU Screen's bindings for the sequence starting from ESC with Screen's command bindkey -t. In this case screen always wait the subsequent byte without timeouts, so ble.sh receives ESC always accompanied by the next byte. If you want to distinguish "isolated ESC" from "modifier ESC", please avoid to use Screen's command bindkey -t for the key sequences starting from ESC.

3.5.4 Timeout of the terminal multiplexer tmux (~/.tmux.conf)

When the terminal multiplexer tmax is in use, the timeout should be configured as well. The following setting can be added in ~/.tmux.conf. The unit is millisecond.

# Example: in ~/.tmux.conf

set -sg escape-time 1

3.5.5 Bleopt decode_isolated_esc (v0.2)

# default
bleopt decode_isolated_esc=auto

When the value is esc, an isolated ESC is treated as C-[. When the value is meta, an isolated ESC is treated as the Meta modifier to the next key. When the value is auto, an isolated ESC is treated as C-[ if there are no pending key inputs waiting the next key and also the current keymap has a binding for C-[. Otherwise the isolated ESC is treated as the Meta modifier.

If your keyboard does not have the Meta modifier key or you want to input Meta modifier by pressing ESC by hand, the setting meta is useful. If you want to distinguish the Meta modifier by the Meta key and directly input ESC or C-[, the setting esc or auto is useful.

3.6 Settings for modifyOtherKeys

ble.sh uses the terminal feature modifyOtherKeys to distinguish various key board inputs by users. When the terminal supports this feature, modifyOtherKeys have three states. The state 0 is the normal state in which the key inputs are sent to the terminal with the simplest modifications. The state 1 is the one in which the escape sequence of normal character keys are modified by modifier keys to allow terminal applications distinguish them. The state 2 allows every inputs including RET key and TAB key have distinguishable escape sequences with modifications by modifier keys. ble.sh sends control sequences to attempt to change the terminal's modifyOtherKeys state. The control sequences CSI > 4 m, CSI > 4 ; 1 m and CSI > 4 ; 2 m are sent to turn the state to 0, 1 and 2, respectively.

To enable modifyOtherKeys in tmux, the following setting should be added to ~/.tmux.conf. To apply the new setting, all the existing sessions might need to be terminated before creating a new session.

# ~/.tmux.conf

set -g extended-keys on

The following options can be used to configure the modifyOtherKeys state when ble.sh is waiting user inputs and when it is in another states.

3.6.1 Bleopt term_modifyOtherKeys_internal (Empty/Non-empty) (v0.3)

# default
bleopt term_modifyOtherKeys_internal=auto

This setting controls how the terminal's modifyOtherKeys is updated on entering the mode in which ble.sh waits the user inputs. When the value is 0, 1 or 2, the state will be changed to the corresponding states, respectively. When the value is auto, the terminal's DA2 response doesn't start with 1;, the state will be changed to 2. If the terminal's DA2 response starts with 1;, the terminal is possibly libvte which have bugs in parsing control sequences, so no control sequences are sent for modifyOtherKeys. When other values are set, no control sequences are sent.

3.6.2 Bleopt term_modifyOtherKeys_external (Empty/Non-empty) (v0.3)

# default
bleopt term_modifyOtherKeys_external=auto

This setting controls how the terminal's modifyOtherKeys is updated when exiting the mode in which ble.sh waits the user inputs. When the value is 0, 1 or 2, the state will be changed to the corresponding states, respectively. When the value is auto, just like the case of term_modifyOtherKeys_internal the state will be changed to 1 when the terminal's DA2 response doesn't start with 1;. When other values are set, no control sequences are sent.

3.6.3 Bleopt term_modifyOtherKeys_passthrough_kitty_protocol (Empty/Non-empty) (v0.4)

# default
bleopt term_modifyOtherKeys_passthrough_kitty_protocol=

This setting controls whether the kitty-keyboard-protocol sequences should pass-through the terminal multiplexers when the outermost terminal is kitty. When this option has a non-empty string, the pass-through kitty protocol sequences are enabled.

  • This is intended to be used with tmux 3.4+. This works with tmux-3.3a and below as far as the user does not enable CapsLock or NumLock. Note that this might cause problems of keyboard inputs after detaching from tmux; You might lose the control of the terminal applications that do not support extended keys outside the terminal multiplexers.

  • This will cause the same problems when used with multiple windows in GNU screen. You will lose the control of the terminal applications without the support for extended keys when there are more than one ble.sh session or when there is at least one foreground ble.sh session in GNU screen.

3.6.4 Settings for terminals without modifyOtherKeys feature

ble.sh can be used without problems even if your terminal does not support modifyOtherKeys.

However, there will be restrictions of the terminal that a special key combination, such as C-1, C-S-a, S-TAB and C-RET, cannot be sent from the terminal. If the terminal allows the configuration of escape sequences for each key combination, please configure so that the key combination sends an escape sequence of the form ESC [ code ; mod u, where code is the integer that represents Unicode of the character in decimal number, and mod is "1 + (the sum of the values of modifiers)" in decimal numbers. The value of each modifier is summarized below.

Modifier Value
S- 1
M- 2
C- 4
s- 8
H- 16
A- 32

Here are examples of escape sequences.

Key combination Escape sequence Key combination Escape sequence
S-RET ESC [ 1 3 ; 2 u C-0 ESC [ 4 8 ; 5 u
C-RET ESC [ 1 3 ; 5 u C-1 ESC [ 4 9 ; 5 u
C-S-RET ESC [ 1 3 ; 6 u C-2 ESC [ 5 0 ; 5 u
S-TAB ESC [ 9 ; 2 u C-3 ESC [ 5 1 ; 5 u
C-TAB ESC [ 9 ; 5 u C-4 ESC [ 5 2 ; 5 u
C-S-TAB ESC [ 9 ; 6 u C-5 ESC [ 5 3 ; 5 u
S-SP ESC [ 3 2 ; 2 u C-6 ESC [ 5 4 ; 5 u
C-S-SP ESC [ 3 2 ; 6 u C-7 ESC [ 5 5 ; 5 u
S-BS ESC [ 8 ; 2 u C-8 ESC [ 5 6 ; 5 u
C-S-BS ESC [ 8 ; 6 u C-9 ESC [ 5 7 ; 5 u
C-S-a ESC [ 9 7 ; 6 u C-S-z ESC [ 1 2 2 ; 6 u

Most terminals support the following function-key modification by default, but, in case not, these can also be configured. The sequences of insert, delete, and prior depend on the terminal type, xterm-like one or vt100-like one. Modern terminals are basically xterm-like.

Key combination Escape sequence Key combination Escape sequence Key combination Escape sequence
S-up ESC [ 1 ; 2 A C-up ESC [ 1 ; 5 A C-S-up ESC [ 1 ; 6 A
S-down ESC [ 1 ; 2 B C-down ESC [ 1 ; 5 B C-S-down ESC [ 1 ; 6 B
S-right ESC [ 1 ; 2 C C-right ESC [ 1 ; 5 C C-S-right ESC [ 1 ; 6 C
S-left ESC [ 1 ; 2 D C-left ESC [ 1 ; 5 D C-S-left ESC [ 1 ; 6 D
S-home ESC [ 1 ; 2 H C-home ESC [ 1 ; 5 H C-S-home ESC [ 1 ; 6 H
S-end ESC [ 1 ; 2 F C-end ESC [ 1 ; 5 F C-S-end ESC [ 1 ; 6 F
S-insert (xterm-like) ESC [ 2 ; 2 ~ C-insert ESC [ 2 ; 5 ~ C-S-insert ESC [ 2 ; 6 ~
S-delete (xterm-like) ESC [ 3 ; 2 ~ C-delete ESC [ 3 ; 5 ~ C-S-delete ESC [ 3 ; 6 ~
S-prior (xterm-like) ESC [ 5 ; 2 ~ C-prior ESC [ 5 ; 5 ~ C-S-prior ESC [ 5 ; 6 ~
S-insert (vt100-like) ESC [ 1 ; 2 ~ C-insert ESC [ 1 ; 5 ~ C-S-insert ESC [ 1 ; 6 ~
S-delete (vt100-like) ESC [ 4 ; 2 ~ C-delete ESC [ 4 ; 5 ~ C-S-delete ESC [ 4 ; 6 ~
S-prior (vt100-like) ESC [ 3 ; 2 ~ C-prior ESC [ 3 ; 5 ~ C-S-prior ESC [ 3 ; 6 ~
S-next ESC [ 6 ; 2 ~ C-next ESC [ 6 ; 5 ~ C-S-next ESC [ 6 ; 6 ~

3.7 Input settings

3.7.1 Bleopt decode_abort_char (Integer) (v0.3)

# default
bleopt decode_abort_char=28

This setting specifies a byte code which can be used to cancel the processing of the massive inputs. The default value is 28 which corresponds to C-\

3.7.2 Bleopt decode_error_char_abell (Empty/Non-empty)

# default
bleopt decode_error_char_abell=     # ble-0.2以降
bleopt error_char_abell=            # ble-0.1

When this setting has a non-empty value, the audible bell is used to notify the reception of incorrectly encoded characters. Specifically it sends a control character BEL.

3.7.3 Bleopt decode_error_char_vbell (Empty/Non-empty)

# default
bleopt decode_error_char_vbell=1    # ble-0.2以降
bleopt error_char_vbell=1           # ble-0.1

When this setting has a non-empty value, a visual bell is used to notify the reception of incorrectly encoded characters.

3.7.4 Bleopt decode_error_char_discard (Empty/Non-empty)

# default
bleopt decode_error_char_discard=   # ble-0.2以降
bleopt error_char_discard=          # ble-0.1

When this setting has a non-empty value, incorrectly encoded characters are removed from the character sequences. When this setting has the empty value, the incorrectly encoded characters are passed to the subsequent processes by ignoring the error.

3.7.5 Bleopt decode_error_cseq_abell (Empty/Non-empty) (v0.3)

# default
bleopt decode_error_cseq_abell=

When this has a non-empty value, unrecognized CSI sequences trigger the audible bell.

3.7.6 Bleopt decode_error_cseq_vbell (Empty/Non-empty) (v0.3)

# default
bleopt decode_error_cseq_vbell=1

When this has a non-empty value, unrecognized CSI sequences trigger the visual bell.

3.7.7 Bleopt decode_error_cseq_discard (Empty/Non-empty) (v0.3)

# default
bleopt decode_error_cseq_discard=

When this has a non-empty value, the entire unrecognized CSI sequences is ignored. When this has the empty value, the bytes consisting the CSI sequences are processed separately.

3.7.8 Bleopt decode_error_kseq_abell (Empty/Non-empty)

# default
bleopt decode_error_kseq_abell=1    # ble-0.2以降
bleopt error_kseq_abell=1           # ble-0.1

When this has a non-empty value, the audible bell is used to notify that there are no binding corresponding to the received key sequences.

3.7.9 Bleopt decode_error_kseq_vbell (Empty/Non-empty)

# default
bleopt decode_error_kseq_vbell=1    # ble-0.2以降
bleopt error_kseq_vbell=1           # ble-0.1

When this has a non-empty value, the visual bell is used to notify that there are no binding corresponding to the received key sequences.

3.7.10 Bleopt decode_error_kseq_discard (Empty/Non-empty)

# default
bleopt decode_error_kseq_discard=1  # ble-0.2以降
bleopt error_kseq_discard=1         # ble-0.1

When this has a non-empty value, the entire key sequence is discarded if there are no binding corresponding to the received key sequences. When this has the empty value, the first key is discarded, and the subsequent keys are used to search the next matching key sequences.

3.7.11 Bleopt decode_macro_limit (Arithmetic) (v0.4)

# default
bleopt decode_macro_limit=1024

This variable sets the limit to the count of recursive calls of keyboard macros.

3.7.12 Bleopt default_keymap

# default
bleopt default_keymap=auto

This setting controls the default editing mode. The value auto means that the editing mode follows the Bash's editing mode. When Bash is in Emacs editing mode (set -o emacs, default), Emacs editing mode of ble.sh is enabled. When Bash is in Vi editing mode (set -o vi), Vim editing mode of ble.sh is enabled. When the value emacs is set, Emacs editing mode of ble.sh is always used regardless of the state of Bash's editing mode. When the value vi is set, Vim editing mode of ble.sh is always used.

3.7.13 Bleopt term_bracketed_paste_mode (Empty/Non-empty) (v0.4)

# bashrc

# default
bleopt term_bracketed_paste_mode=on
bind 'set enable-bracketed-paste on'

When a non-empty value is specified, the terminal's Bracketed Paste Mode (DEC mode 2004) is enabled. This setting is synchronized with the readline variable enable-bracketed-paste.


[ 日本語 | English ] ≫ Manual [§1 Intro | §2 Color | §3 Bind | §4 Edit | §5 Emacs | §6 Vim | §7 Comp | §8 Misc | Index]

Clone this wiki locally