Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash 在inputrc中绑定meta没有效果,macosx_Bash_Terminal_Readline_Ansi Escape_Meta Key - Fatal编程技术网

Bash 在inputrc中绑定meta没有效果,macosx

Bash 在inputrc中绑定meta没有效果,macosx,bash,terminal,readline,ansi-escape,meta-key,Bash,Terminal,Readline,Ansi Escape,Meta Key,我试图通过在我的inputrc中为元键添加绑定来扩展readline。我正在使用终端(OSX) 理想情况下,我想添加“\M-h”:“\C-w” 但是,我似乎无法绑定任何元密钥。我在终端中有一个选项,它将我的选项键视为元。因此,我可以输入M-b很好。在我的inputrc中绑定到它不起作用 我尝试使用sed-nl记录发送到终端的转义序列。按M-x输出^[h,但是像“^[h”:“\C-w”这样的绑定不起作用。非常感谢您的帮助 编辑:这是readline文档中的一个示例,它显示了如何基于发送的ansi转

我试图通过在我的inputrc中为元键添加绑定来扩展readline。我正在使用终端(OSX)

理想情况下,我想添加
“\M-h”:“\C-w”

但是,我似乎无法绑定任何元密钥。我在终端中有一个选项,它将我的选项键视为元。因此,我可以输入
M-b
很好。在我的inputrc中绑定到它不起作用

我尝试使用
sed-nl
记录发送到终端的转义序列。按
M-x
输出
^[h
,但是像
“^[h”:“\C-w”
这样的绑定不起作用。非常感谢您的帮助


编辑:这是readline文档中的一个示例,它显示了如何基于发送的ansi转义键进行绑定。也许我没有映射到发送的正确转义键,有没有比使用sed更好的方法进行检查?

这是绑定它的正确方法?不应该是keyname:function name吗?但没有将其删除

从手册页:

   Readline Key Bindings
   The syntax for controlling key bindings in the inputrc file is simple.  All that is required is the name of the command or the text of a macro and a key sequence to which
   it should be bound. The name may be specified in one of two ways: as a symbolic key name, possibly with Meta- or Control- prefixes, or as a key sequence.

   When using the form keyname:function-name or macro, keyname is the name of a key spelled out in English.  For example:

          Control-u: universal-argument
          Meta-Rubout: backward-kill-word
          Control-o: "> output"

   In the above example, C-u is bound to the function universal-argument, M-DEL is bound to the function backward-kill-word, and C-o is bound to run the macro  expressed  on
   the right hand side (that is, to insert the text \u2018\u2018> output\u2019\u2019 into the line).

   In  the  second  form,  "keyseq":function-name or macro, keyseq differs from keyname above in that strings denoting an entire key sequence may be specified by placing the
   sequence within double quotes.  Some GNU Emacs style key escapes can be used, as in the following example, but the symbolic character names are not recognized.

          "\C-u": universal-argument
          "\C-x\C-r": re-read-init-file
          "\e[11~": "Function Key 1"

   In this example, C-u is again bound to the function universal-argument.  C-x C-r is bound to the function re-read-init-file, and ESC [ 1 1 ~ is bound to insert  the  text
   \u2018\u2018Function Key 1\u2019\u2019.

您也可以考虑查看/ETC/IpUrtC,它具有默认绑定。

< P>我的问题的解决方案是以下绑定:<代码> \ eh“:”\cw“< /COD>< /P>”
\e
是readline到Esc键的映射

没有统一的方法来表示键盘上的元键,因此:

Mac OS X终端的“作为元密钥的选项”选项仅表示>“带有ESC的前缀”——


因此,终端将Meta视为选项,然后将Esc发送到readline。

我相信是这样。这是readline文档中的一个示例。好的。对不起。也感谢回答中的澄清。