Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6895323
  • 博文数量: 3857
  • 博客积分: 6409
  • 博客等级: 准将
  • 技术积分: 15948
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-02 16:48
个人简介

迷彩 潜伏 隐蔽 伪装

文章分类

全部博文(3857)

文章存档

2017年(5)

2016年(63)

2015年(927)

2014年(677)

2013年(807)

2012年(1241)

2011年(67)

2010年(7)

2009年(36)

2008年(28)

分类:

2013-01-05 09:26:44


编辑 /etc/inputrc 文件,设置全局readline配置,加入以下指令:

# I like vi mode,设置默认的编辑模式为vi
set editing-mode vi

# emacs mode settings,emacs模式配置指令
$if mode=emacs

# ...

# vi mode settings,vi模式配置指令
$else

# Ctrl+l : clear screen ,清屏
"\C-l": clear-screen 

# Ctrl+p : previous-history,前一条历史命令
"\C-p": previous-history

# Ctrl+n : next-history,后一条历史命令
"\C-n": next-history

# Ctrl+e : press esc,ESC键,你懂的
"\C-e": "\e"

$endif

说明:
/etc/inputrc 文件是 libreadline 的全局配置文件,个人的配置文件为 ~/.inputrc 

关于libreadline 的介绍如下:
The GNU Readline library provides a set of functions for use by applications that allow users to edit command lines as they are typed in. Both Emacs and vi editing modes are available. The Readline library includes additional functions to maintain a list of previously-entered command lines, to recall and perhaps reedit those lines, and perform csh-like history expansion on previous commands.

The history facilites are also placed into a separate library, the History library, as part of the build process. The History library may be used without Readline in applications which desire its capabilities.

Readline is free software, distributed under the terms of the GNU General Public License, version 3. This means that if you want to use Readline in a program that you release or distribute to anyone, the program must be free software and have a GPL-compatible license. If you would like advice on making your license GPL-compatible, contact licensing@gnu.org.

bash就是通过readline library 来提供命令行的方便快捷的编辑功能,包括各种用于命令编辑的快捷键,命令历史操作等功能。
阅读(622) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~