BEGINNER'S GUIDE TO ZSH KEYBOARD ASSIGNMENTS, AKA 'KEYBOARD BINDINGS'.
(欢迎评论,改进,痛苦的指责:Eastlink dot ca上的rayandrews)
Debian Linux上xfce4下运行“ zsh”的PC上连接的PC上的“ 101” PC键盘上的“可用”键组合(我不知道是谁负责)。除显示的最简单的头像外,所有在“灰色”键中产生重复代码的组合都已删除。请注意,某些灰色键/组合具有“ ^字母”重复项,例如“ Enter” ==“ ^ M”,但这些重复项尚未删除。由于系统使用了其他有效组合,因此无法“使用”,即使是从控制台(例如控制台)也可以使用。“ Alt + Function”键可切换端子。也许'Meta'键会做更多的事情,但这只有101 KB。有趣的是,在DOS中有更多的组合可用,例如Ctrl + Function,所有组合都在DOS中可用,而在Linux中都没有,因此看来。三联键组合(例如“ Ctrl + Alt + Up”)中没有一个在灰色键中产生任何唯一代码,但在白色键中却产生了代码。有趣的异常现象:'^ [[22''^ [[27''^ [[30'正在丢失”,您真想知道为什么忽略了这些数字。(这就是说,您可能希望'F11'为'^ [[22',而不是'^ [[23'。)。”
所显示的密钥代码与在CLI上由“ showkeys -a”或“ bindkey”输出的一样。但是,由于某些原因,如果您在脚本中使用“ bindkey”(例如在“ .zshrc”中),则必须将“ ^ [”替换为“ \ e”,因此在CLI中:
bindkey -s'^ [[[[A''my-command \ Cm'
...将'F1'绑定到'my-command'并执行它('\ Cm'模拟'Enter'键)。
在“ .zshrc”中:
bindkey -s'\ e [25''my-command1; 我的命令2 \ Cm'
...将“ Shift-F1”绑定到“ my-command1”,然后绑定“ my-command2”,然后执行它们。
仅使用“灰色” 键进行组合:
键[ F1 ] = '^ [[[[A]
键[ F2 ] = '^ [[[B]
键[ F3 ] = '^ [[[C'
键[ F4 ] = '^ [[[D'
键[ F5 ] = '^ [[[[E]
键[ F6 ] = '^ [[17〜'
键[ F7 ] = '^ [[18〜'
键[ F8 ] = '^ [[19〜'
键[ F9 ] = '^ [[20〜'
键[ F10 ] = '^ [[21〜'
键] [ F11 ] = '^ [[23〜'
键] [ F12 ] = '^ [[24〜'
键[ Shift - F1 ] = '^ [[25〜'
键[ Shift - F2 ] = '^ [[26〜'
键] [ Shift - F3 ] = '^ [[28〜'
键[ Shift - F4 ] = ' ^ [[29〜'
键[ Shift - F5 ] = '^ [[31〜'
键[ Shift - F6 ] = '^ [[32〜'
键[ Shift - F7 ] = '^ [[33〜'
键[ Shift - F8 ] = '^ [[34〜'
键[ 插入] = '^ [[2〜'
键] [ 删除] = '^ [[3〜'
键] [ 主页] = '^ [[1〜'
键] [ 结束] = '^ [[4〜'
键[ PageUp ] = '^ [[ 5〜'
键] [ PageDown ] = '^ [ [ 6〜'
键] [ Up ] = '^ [[A'
键[ Down ] = '^ [[B'
键[ Right ] = '^[[C'
key[Left] = '^[[D'
键[ Bksp ] = '^?'
key[Bksp-Alt] = '^[^?'
key[Bksp-Ctrl] = '^H' console only.
key[Esc] = '^['
key[Esc-Alt] = '^[^['
key[Enter] = '^M'
key[Enter-Alt] = '^[^M'
键[ Tab ] = '^I' or '\t' unique form! can be bound, but does not 'showkey -a'.
key[Tab-Alt] = '^[\t'
COMBINATIONS USING THE WHITE KEYS:
Anomalies:
'Ctrl+`' == 'Ctrl+2', and 'Ctrl+1' == '1' in xterm.
Several 'Ctrl+number' combinations are void at console, but return codes in xterm. OTOH Ctrl+Bksp returns '^H' at console, but is identical to plain 'Bksp' in xterm. There are no doubt more of these little glitches however, in the main:
White key codes are easy to undertand, each of these 'normal' printing keys has six forms:
一个 = 'A' (duhhh )
一- 移= 'A' (谁又能猜到?)
一个- Alt键= '^ [A'
一- 按Ctrl = '^ A'
一- Alt键- 按Ctrl = “^ [^ A “
一-
Alt-Shift = '^[A'
A-Ctrl-Shift = '^A' (Shift has no effect)
Don't forget that:
/-Shift-Ctrl = Bksp = '^?'
[-Ctrl = Esc = '^['
M-Ctrl = Enter = '^M'
And, we can 'stack' keybindings:
bindkey -s '^Xm' "My mistress\' eyes are nothing like the sun."
... Bind 'Ctrl-X' followed by 'm' to a nice line of poetry.
And we can flirt with madness:
bindkey -s '^Pletmenot' 'Let me not, to the marriage of true minds'
... but you hafta start something like that with a 'modifier' character. Try it, if you like keyboard shortcuts, you can really go to town.
QUESTIONS:
Where is it written that 'Ctrl-Bksp' means one thing at console, another thing in xterm?
Are these assignments changable?
Who designed all this, and what were they thinking at the time?
为什么在终端更改“ Alt - Function ” a terminal, but 'Alt-Ctrl-Function' to change to a terminal from GUI?
如何/在哪里定义“ Alt - Ctrl - Delete ”?
enter code here
stty -a
说明lnext
),然后按键。