Skip to main content
deleted 24 characters in body
Source Link
Stéphane Chazelas
  • 586.3k
  • 96
  • 1.1k
  • 1.7k

On most xterm-like terminals, the Up (and it's similar for most navigation keys) send either ␛[A or ␛OA depending on whether the terminal has been put in keypad transmit mode or not. The smkx and rmkx terminfo entries can be used to put a terminal in or out of that mode.

The kcuu1 (key cursor up by 1) terminfo entry describes the sequence sent by Up when in keypad transmit mode, that is ␛OA.

Debian and derivatives have a /etc/zsh/zshrc file that does a

 function zle-line-init () {   emulate -L zsh   printf > /dev/tty '%s' ${terminfo[smkx]}  } 

Which puts the terminal in that mode when zle is active, which means you can now rely on the terminfo database to know what character sequences keys transmit.

The file also defines a $key associative array based on the terminfo entries to help you map those to widgets. So on those systems, you can do:

(($+key[Up])) && bindkey $key[Up] history-beginning-search-backward 

For something that works on systems where the terminal is in keypad transmit mode and those that don't or don't have the $key hash, you can do:

bindkey $terminfo[kcuu1] history-beginning-search-backward bindkey ${terminfo[kcuu1]/O/[} history-beginning-search-backward 

See also:

On most xterm-like terminals, the Up (and it's similar for most navigation keys) send either ␛[A or ␛OA depending on whether the terminal has been put in keypad transmit mode or not. The smkx and rmkx terminfo entries can be used to put a terminal in or out of that mode.

The kcuu1 (key cursor up by 1) terminfo entry describes the sequence sent by Up when in keypad transmit mode, that is ␛OA.

Debian and derivatives have a /etc/zsh/zshrc file that does a

 function zle-line-init () {   emulate -L zsh   printf > /dev/tty '%s' ${terminfo[smkx]}  } 

Which puts the terminal in that mode when zle is active, which means you can now rely on the terminfo database to know what character sequences keys transmit.

The file also defines a $key associative array based on the terminfo entries to help you map those to widgets. So on those systems, you can do:

(($+key[Up])) && bindkey $key[Up] history-beginning-search-backward 

For something that works on systems where the terminal is in keypad transmit mode and those that don't or don't have the $key hash, you can do:

bindkey $terminfo[kcuu1] history-beginning-search-backward bindkey ${terminfo[kcuu1]/O/[} history-beginning-search-backward 

See also:

On most xterm-like terminals, the Up (and it's similar for most navigation keys) send either ␛[A or ␛OA depending on whether the terminal has been put in keypad transmit mode or not. The smkx and rmkx terminfo entries can be used to put a terminal in or out of that mode.

The kcuu1 (key cursor up by 1) terminfo entry describes the sequence sent by Up when in keypad transmit mode, that is ␛OA.

Debian and derivatives have a /etc/zsh/zshrc file that does a

function zle-line-init () { emulate -L zsh printf > /dev/tty '%s' ${terminfo[smkx]} } 

Which puts the terminal in that mode when zle is active, which means you can now rely on the terminfo database to know what character sequences keys transmit.

The file also defines a $key associative array based on the terminfo entries to help you map those to widgets. So on those systems, you can do:

(($+key[Up])) && bindkey $key[Up] history-beginning-search-backward 

For something that works on systems where the terminal is in keypad transmit mode and those that don't or don't have the $key hash, you can do:

bindkey $terminfo[kcuu1] history-beginning-search-backward bindkey ${terminfo[kcuu1]/O/[} history-beginning-search-backward 

See also:

added 287 characters in body
Source Link
Stéphane Chazelas
  • 586.3k
  • 96
  • 1.1k
  • 1.7k

On most xterm-like terminals, the Up (and it's similar for most navigation keys) send either ␛[A or ␛OA depending on whether the terminal has been put in keypad transmit mode or not. The smkx and rmkx terminfo entries can be used to put a terminal in or out of that mode.

The kcuu1 (key cursor up by 1) terminfo entry describes the sequence sent by Up when in keypad transmit mode, that is ␛OA.

Debian and derivatives have a /etc/zsh/zshrc file that does a

 function zle-line-init () { emulate -L zsh printf > /dev/tty '%s' ${terminfo[smkx]} } 

Which puts the terminal in that mode when zle is active, which means you can now rely on the terminfo database to know what character sequences keys transmit.

AndThe file also defines a $key associative arraydefines a $key associative array based on the terminfo entries to help you map those to widgets. So on those systems, you can do:

(($+key[Up])) && bindkey $key[Up] history-beginning-search-backward 

For something that works on systems where the terminal is in keypad transmit mode and those that don't or don't have the $key hash, you can do:

bindkey $terminfo[kcuu1] history-beginning-search-backward bindkey ${terminfo[kcuu1]/O/[} history-beginning-search-backward 

See also:

On most xterm-like terminals, the Up (and it's similar for most navigation keys) send either ␛[A or ␛OA depending on whether the terminal has been put in keypad transmit mode or not. The smkx and rmkx terminfo entries can be used to put a terminal in or out of that mode.

The kcuu1 (key cursor up by 1) terminfo entry describes the sequence sent by Up when in keypad transmit mode, that is ␛OA.

Debian and derivatives have a /etc/zsh/zshrc file that does a

 function zle-line-init () { emulate -L zsh printf > /dev/tty '%s' ${terminfo[smkx]} } 

Which puts the terminal in that mode when zle is active.

And also defines a $key associative array based on the terminfo entries to help you map those to widgets. So on those systems, you can do:

bindkey $key[Up] history-beginning-search-backward 

For something that works on systems where the terminal is in keypad transmit mode and those that don't or don't have the $key hash, you can do:

bindkey $terminfo[kcuu1] history-beginning-search-backward bindkey ${terminfo[kcuu1]/O/[} history-beginning-search-backward 

See also:

On most xterm-like terminals, the Up (and it's similar for most navigation keys) send either ␛[A or ␛OA depending on whether the terminal has been put in keypad transmit mode or not. The smkx and rmkx terminfo entries can be used to put a terminal in or out of that mode.

The kcuu1 (key cursor up by 1) terminfo entry describes the sequence sent by Up when in keypad transmit mode, that is ␛OA.

Debian and derivatives have a /etc/zsh/zshrc file that does a

 function zle-line-init () { emulate -L zsh printf > /dev/tty '%s' ${terminfo[smkx]} } 

Which puts the terminal in that mode when zle is active, which means you can now rely on the terminfo database to know what character sequences keys transmit.

The file also defines a $key associative array based on the terminfo entries to help you map those to widgets. So on those systems, you can do:

(($+key[Up])) && bindkey $key[Up] history-beginning-search-backward 

For something that works on systems where the terminal is in keypad transmit mode and those that don't or don't have the $key hash, you can do:

bindkey $terminfo[kcuu1] history-beginning-search-backward bindkey ${terminfo[kcuu1]/O/[} history-beginning-search-backward 

See also:

added 287 characters in body
Source Link
Stéphane Chazelas
  • 586.3k
  • 96
  • 1.1k
  • 1.7k

On most xterm-like terminals, the Up (and it's similar for most navigation keys) send either ␛[A or ␛OA depending on whether the terminal has been put in keypad transmit mode or not. The smkx and rmkx terminfo entries can be used to put a terminal in or out of that mode.

The kcuu1 (key cursor up by 1) terminfo entry describes the sequence sent by Up when in keypad transmit mode, that is ␛OA.

Debian and derivatives have a /etc/zsh/zshrc file that does a

 function zle-line-init () { emulate -L zsh printf > /dev/tty '%s' ${terminfo[smkx]} } 

Which puts the terminal in that mode when zle is active.

And also defines a $key associative array based on the terminfo entries to help you map those to widgets. So on those systems, you can do:

bindkey $key[Up] history-beginning-search-backward 

For something that works on systems where the keypadterminal is in keypad transmit mode and those that don't or don't have the $key hash, you can do:

bindkey $terminfo[kcuu1] history-beginning-search-backward bindkey ${terminfo[kcuu1]/O/[} history-beginning-search-backward 

See also:

On most xterm-like terminals, the Up (and it's similar for most navigation keys) send either ␛[A or ␛OA depending on whether the terminal has been put in keypad transmit mode or not. The smkx and rmkx terminfo entries can be used to put a terminal in or out of that mode.

The kcuu1 (key cursor up by 1) terminfo entry describes the sequence sent by Up when in keypad transmit mode, that is ␛OA.

Debian and derivatives have a /etc/zsh/zshrc file that does a

 function zle-line-init () { emulate -L zsh printf > /dev/tty '%s' ${terminfo[smkx]} } 

Which puts the terminal in that mode when zle is active.

And also defines a $key associative array based on the terminfo entries to help you map those to widgets. So on those systems, you can do:

bindkey $key[Up] history-beginning-search-backward 

For something that works on systems where the keypad is in keypad transmit and those that don't or don't have the $key hash, you can do:

bindkey $terminfo[kcuu1] history-beginning-search-backward bindkey ${terminfo[kcuu1]/O/[} history-beginning-search-backward 

On most xterm-like terminals, the Up (and it's similar for most navigation keys) send either ␛[A or ␛OA depending on whether the terminal has been put in keypad transmit mode or not. The smkx and rmkx terminfo entries can be used to put a terminal in or out of that mode.

The kcuu1 (key cursor up by 1) terminfo entry describes the sequence sent by Up when in keypad transmit mode, that is ␛OA.

Debian and derivatives have a /etc/zsh/zshrc file that does a

 function zle-line-init () { emulate -L zsh printf > /dev/tty '%s' ${terminfo[smkx]} } 

Which puts the terminal in that mode when zle is active.

And also defines a $key associative array based on the terminfo entries to help you map those to widgets. So on those systems, you can do:

bindkey $key[Up] history-beginning-search-backward 

For something that works on systems where the terminal is in keypad transmit mode and those that don't or don't have the $key hash, you can do:

bindkey $terminfo[kcuu1] history-beginning-search-backward bindkey ${terminfo[kcuu1]/O/[} history-beginning-search-backward 

See also:

Source Link
Stéphane Chazelas
  • 586.3k
  • 96
  • 1.1k
  • 1.7k
Loading