zoukankan      html  css  js  c++  java
  • inputrc命令

    问题:搭建ubuntu系统后,输入命令的第一个字符+上页按键,发现不能找到历史命令,找了好久才发现是因为/etc/inputrc没有对键盘映射的上页键和下页键进行设置。

    解决方法:

    修改文件/etc/inputrc,添加对上页键和下页键的设置如下

    # vim /etc/inputrc      

    "e[5~": history-search-backward

    "e[6~": history-search-forward

    重启系统后就可以实现快速寻找历史命令

    /etc/inputrc详解

    Inputrc 用来处理键盘映射表。这个文件在启动的时候被一个bash和其他shell使用的库,readline,调用。

    全局的设定值包含在 /etc/inputrc中。 每个用户自己的值设定于~/.inputrc。 ~/.inputrc 若存在,则会忽略全局设定值。前面bash设定中缺省调用 /etc/inputrc 如果你想让系统同时使用两个设定,可以把一个 .inputrc放到/etc/skel 中给每一个新建立的用户使用。

    参数详解:

    # emacs模式的一些默认/修改
    $if mode=emacs

    # 允许使用Home/End键
    "e[1~": beginning-of-line
    "e[4~": end-of-line

    # 允许使用Delete/Insert 键
    "e[3~": delete-char
    "e[2~": quoted-insert

    # “page up”和“page down”的映射将逐步进入历史的开始/结束
     "e[5~": beginning-of-history
     "e[6~": end-of-history

    # “page up”和“page down”搜索历史的替代映射
    "e[5~": history-search-backward
    "e[6~": history-search-forward

    #ctrl -左箭头和ctrl -右箭头用于单词移动的映射
    "e[1;5C": forward-word
    "e[1;5D": backward-word
    "e[5C": forward-word
    "e[5D": backward-word
    "ee[C": forward-word
    "ee[D": backward-word

    $if term=rxvt
    "e[7~": beginning-of-line
    "e[8~": end-of-line
    "eOc": forward-word
    "eOd": backward-word
    $endif

    # 对于非RH/Debian xterm,对RH/Debian xterm没有害处
    # "eOH": beginning-of-line
    # "eOF": end-of-line

    # 支持freebsd控制台
    # "e[H": beginning-of-line
    # "e[F": end-of-line

    $endif

    set horizontal-scroll-mode Off         # 确认我们不会在同一行中输出所有的东西。

    set meta-flag On              # 开启8比特输入

    set input-meta On

    set convert-meta Off              # 禁止对第8个比特过滤

    set output-meta On                # 在显示时保存第8个比特

    set bell-style none                 # 关闭可视和声音提示

    # 函数第一部分中包括的换码符序列的值

    "eOd": backward-word

    "eOc": forward-word

    # 在控制台使用

    "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

    # xterm使用

    "eOH": beginning-of-line

    "eOF": end-of-line

  • 相关阅读:
    VUE处理项目中的ESLint语法报错问题
    通过Focas连接Fanuc的NC Guide
    IdentityServer
    Dapper2.0.78手册翻译
    Framework项目持续集成(jenkins)及集合SonarQube
    基于 GitBook 搭建个人博客
    GitBook 常用插件
    Vue管理系统前端系列六动态路由-权限管理实现
    Vue管理系统前端系列五自定义主题
    Vue管理系统前端系列四组件拆分封装
  • 原文地址:https://www.cnblogs.com/carriezhangyan/p/11840960.html
Copyright © 2011-2022 走看看