自定义〜/ .inputrc定义没有正确采购?

时间:2016-05-12 17:18:37

标签: bash

我的~/.inputrc中有以下内容:

set input-meta on
set output-meta on
set convert-meta off

# To use these in ITerm2 you may also need to configure preferences to send the correct escape
# code for the key combination.

# Option + Arrows to jump words.
"\e[1;5C": forward-word
"\e[1;5D": backward-word


# The following are other escape sequences that can be configured in Iterm2 preferences.
#        ESC ^H   Delete previous word (backspace key) [n]
#        ESC DEL  Delete previous word (delete key) [n]
#        ESC SP   Set the mark (space key); see ^X^X and ^Y above
#        ESC .    Get the last (or [n]'th) word from previous line
#        ESC ?    Show possible completions; see below
#        ESC <    Move to start of history
#        ESC >    Move to end of history
#        ESC b    Move backward a word [n]
#        ESC d    Delete word under cursor [n]
#        ESC f    Move forward a word [n]
#        ESC l    Make word lowercase [n]
#        ESC u    Make word uppercase [n]
#        ESC y    Yank back last killed text
#        ESC v    Show library version
#        ESC w    Make area up to mark yankable
#        ESC nn   Set repeat count to the number nn
#        ESC C    Read from environment variable ``_C_'', where C is
#                 an uppercase letter

但是,当我采购时,会发生这种情况:

me (~/Desktop) $ . ~/.inputrc
-bash: \e[1;5C:: command not found
-bash: \e[1;5D:: command not found

是什么给出了?

编辑:也在iTerm2上

1 个答案:

答案 0 :(得分:1)

.inputrc不是shell脚本;它是Readline库使用的配置文件,bash使用它。您可以通过键入 Control - x Control - r (默认绑定)来重新读取文件re-read-init-file Readline函数)。

将密钥绑定放在.inputrc中的好处是,使用Readline的任何程序都会读取此文件,而不仅仅是bash。您可以使用.bashrc命令在bind中添加绑定。

bind '"\e[1;5C": forward-word'

(当然,此类绑定可在bash中使用。)