出售域名  LinuxTags

7.8. 创建 /etc/inputrc 文件

inputrc 文件的作用是告知系统应该以怎样的键盘布局处理键盘。此文件对于 readline(readline: GNU readline library,和输入紧密相关的库)或者是一些 shell (例如 bash 等)来说十分重要。

对于大部分用户来说,都不使用那些奇奇怪怪的键盘映射,所以,可以通过以下的命令建立一个全局的 /etc/inputrc 以供所有用户使用。如果需要更改某一个用户的键盘映射,仅需要在那个用户的 HOME 目录下建立一个 .inputrc 文件,然后修改对应的键盘映射就可以了。

如果需要了解更多有关如何编辑 inputrc 文件的信息,可以查看 info bashReadline Init File 一节。其实查看 info readline 也可以获得不少有用的东西啦。

下面显示的就是通用的 inputrc 文件,其中包含有 “#” 的都是注释行(需要注意的是,此文件不支持在设置后跟随注释)。使用以下命令创建此文件:

cat > /etc/inputrc << "EOF"
# Begin /etc/inputrc
# Modified by Chris Lynn <[email protected]>

# Allow the command prompt to wrap to the next line
set horizontal-scroll-mode Off

# Enable 8bit input
set meta-flag On
set input-meta On

# Turns off 8th bit stripping
set convert-meta Off

# Keep the 8th bit for display
set output-meta On

# none, visible or audible
set bell-style none

# All of the following map the escape sequence of the value
# contained in the 1st argument to the readline specific functions
"\eOd": backward-word
"\eOc": forward-word

# for linux console
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
"\e[3~": delete-char
"\e[2~": quoted-insert

# for xterm
"\eOH": beginning-of-line
"\eOF": end-of-line

# for Konsole
"\e[H": beginning-of-line
"\e[F": end-of-line

# End /etc/inputrc
EOF
host by aosp.me CDN 

出售域名  LinuxTags