Chinaunix首页 | 论坛 | 博客
  • 博客访问: 101902077
  • 博文数量: 19283
  • 博客积分: 9968
  • 博客等级: 上将
  • 技术积分: 196062
  • 用 户 组: 普通用户
  • 注册时间: 2007-02-07 14:28
文章分类

全部博文(19283)

文章存档

2011年(1)

2009年(125)

2008年(19094)

2007年(63)

分类: LINUX

2008-05-03 10:18:48

转自 zhaidongplus 的 Blog: http://blog.linuxgem.org/zhaidongplus/show/506.html

大家在终端中敲命令的时候,或许都用过Ctrl+A(移动光标到行首)、Ctrl+U(删除光标至行首的内容)等快捷键吧。这些编辑快捷键都属于emacs的编辑风格,bash默认的命令编辑风格就是emacs式的,我们也可以把编辑风格改为vi式的: 

zhaidong@gentoo ~ $ set -o    #查看bash的设置选项
allexport       off
braceexpand     on
emacs           on
errexit         off
errtrace        off
functrace       off
hashall         on
histexpand      on
history         on
ignoreeof       off
interactive-comments    on
keyword         off
monitor         on
noclobber       off
noexec          off
noglob          off
nolog           off
notify          off
nounset         off
onecmd          off
physical        off
pipefail        off
posix           off
privileged      off
verbose         off
vi              off
xtrace          off
zhaidong@gentoo ~ $ set -o vi     #开启vi选项

现在,在bash中敲命令时为vi的插入模式。按下Esc,就进入了命令模式,很多vi的编辑命令都可以使用。

如果喜欢vi式的bash命令编辑风格,我们可以把set -o vi加入~/.bashrc

zhaidong@gentoo ~ $ echo "set -o vi">>~/.bashrc
阅读(317) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~