当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 6 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : Ubuntu用户,你们能用"Ctrl+Shift+R"搜索命令行历史?(Bash可以如此绑定?)
帖子发表于 : 2016-09-21 21:35 

注册: 2013-05-26 6:58
帖子: 2158
系统: Debian 9
送出感谢: 894
接收感谢: 30
Ubuntu用户,你们能用"Ctrl+Shift+R"搜索命令行历史?(Bash可以如此绑定?)
顺便求你们如下命令的结果:
代码:
bind -P | grep  '^forward-search-history'

bash有办法能设置键盘绑定为"ctrl+shift+R"的形式?
http://stackoverflow.com/questions/1237 ... -and-forth
引用:
On Ubuntu it's definitely Ctrl+Shift+R


我尝试了搜索,但没有发现如何能设置"Ctrl+Shift+R"这样的"Ctrl+Shift"前缀的绑定
我下载了LiveCD运行,没有发现可以这么用
没有安装,只是LiveCD的试用模式


_________________
Linux桌面优化综合贴[2017.09.18](欢迎各位补充或指正误区)
[2016.03.10]会C语言但看不懂英文文档的点这里,一个用C语言编写的简陋学习工具
单硬盘通过iso文件实机安装Debian的方法
重启或操作fcitx时失去响应的一个解决方法,不妨试试看


页首
 用户资料  
 
2 楼 
 文章标题 : Re: Ubuntu用户,你们能用"Ctrl+Shift+R"搜索命令行历史?(Bash可以如此绑定?)
帖子发表于 : 2016-09-21 22:43 
头像

注册: 2011-03-20 13:12
帖子: 4521
地址: 山东省寿光县
系统: Debian
送出感谢: 105
接收感谢: 997
参考 http://stackoverflow.com/a/14876639


_________________
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户



_________________
评价: 3.7% 科学之子
 
页首
 用户资料  
 
3 楼 
 文章标题 : Re: Ubuntu用户,你们能用"Ctrl+Shift+R"搜索命令行历史?(Bash可以如此绑定?)
帖子发表于 : 2016-09-21 22:54 

注册: 2007-01-14 16:23
帖子: 4255
送出感谢: 0 次
接收感谢: 107
你要找的是这个?http://www.hypexr.org/bash_tutorial.php
引用:
Modifying the Bash Shell with the set Command

Two options that can be set using the set command that will be of some interest to the common user are "-o vi" and "-o emacs". As with all of the environment modifying commands these can be typed at the command prompt or inserted into the appropriate file mentioned above.

Set Emacs Mode in Bash
$ set -o emacs

This is usually the default editing mode when in the bash environment and means that you are able to use commands like those in Emacs (defined in the Readline library) to move the cursor, cut and paste text, or undo editing.

Commands to take advantage of bash's Emacs Mode:
ctrl-a Move cursor to beginning of line
ctrl-e Move cursor to end of line
meta-b Move cursor back one word
meta-f Move cursor forward one word
ctrl-w Cut the last word
ctrl-u Cut everything before the cursor
ctrl-k Cut everything after the cursor
ctrl-y Paste the last thing to be cut
ctrl-_ Undo

NOTE: ctrl- = hold control, meta- = hold meta (where meta is usually the alt or escape key).

A combination of ctrl-u to cut the line combined with ctrl-y can be very helpful. If you are in middle of typing a command and need to return to the prompt to retrieve more information you can use ctrl-u to save what you have typed in and after you retrieve the needed information ctrl-y will recover what was cut.
Set Vi Mode in Bash
$ set -o vi

Vi mode allows for the use of vi like commands when at the bash prompt. When set to this mode initially you will be in insert mode (be able to type at the prompt unlike when you enter vi). Hitting the escape key takes you into command mode.

Commands to take advantage of bash's Vi Mode:
h Move cursor left
l Move cursor right
A Move cursor to end of line and put in insert mode
0 (zero) Move cursor to beginning of line (doesn't put in insert mode)
i Put into insert mode at current position
a Put into insert mode after current position
dd Delete line (saved for pasting)
D Delete text after current cursor position (saved for pasting)
p Paste text that was deleted
j Move up through history commands
k Move down through history commands
u Undo


页首
 用户资料  
 
4 楼 
 文章标题 : Re: Ubuntu用户,你们能用"Ctrl+Shift+R"搜索命令行历史?(Bash可以如此绑定?)
帖子发表于 : 2016-09-21 23:59 

注册: 2013-05-26 6:58
帖子: 2158
系统: Debian 9
送出感谢: 894
接收感谢: 30
vickycq 写道:

这意思就是根本没法用"Ctrl+Shift+R"?
那个说Ubuntu能用的是怎么回事呢?


_________________
Linux桌面优化综合贴[2017.09.18](欢迎各位补充或指正误区)
[2016.03.10]会C语言但看不懂英文文档的点这里,一个用C语言编写的简陋学习工具
单硬盘通过iso文件实机安装Debian的方法
重启或操作fcitx时失去响应的一个解决方法,不妨试试看


页首
 用户资料  
 
5 楼 
 文章标题 : Re: Ubuntu用户,你们能用"Ctrl+Shift+R"搜索命令行历史?(Bash可以如此绑定?)
帖子发表于 : 2016-09-22 0:01 

注册: 2013-05-26 6:58
帖子: 2158
系统: Debian 9
送出感谢: 894
接收感谢: 30
onlylove 写道:
你要找的是这个?http://www.hypexr.org/bash_tutorial.php
引用:
Modifying the Bash Shell with the set Command

Two options that can be set using the set command that will be of some interest to the common user are "-o vi" and "-o emacs". As with all of the environment modifying commands these can be typed at the command prompt or inserted into the appropriate file mentioned above.

Set Emacs Mode in Bash
$ set -o emacs

This is usually the default editing mode when in the bash environment and means that you are able to use commands like those in Emacs (defined in the Readline library) to move the cursor, cut and paste text, or undo editing.

Commands to take advantage of bash's Emacs Mode:
ctrl-a Move cursor to beginning of line
ctrl-e Move cursor to end of line
meta-b Move cursor back one word
meta-f Move cursor forward one word
ctrl-w Cut the last word
ctrl-u Cut everything before the cursor
ctrl-k Cut everything after the cursor
ctrl-y Paste the last thing to be cut
ctrl-_ Undo

NOTE: ctrl- = hold control, meta- = hold meta (where meta is usually the alt or escape key).

A combination of ctrl-u to cut the line combined with ctrl-y can be very helpful. If you are in middle of typing a command and need to return to the prompt to retrieve more information you can use ctrl-u to save what you have typed in and after you retrieve the needed information ctrl-y will recover what was cut.
Set Vi Mode in Bash
$ set -o vi

Vi mode allows for the use of vi like commands when at the bash prompt. When set to this mode initially you will be in insert mode (be able to type at the prompt unlike when you enter vi). Hitting the escape key takes you into command mode.

Commands to take advantage of bash's Vi Mode:
h Move cursor left
l Move cursor right
A Move cursor to end of line and put in insert mode
0 (zero) Move cursor to beginning of line (doesn't put in insert mode)
i Put into insert mode at current position
a Put into insert mode after current position
dd Delete line (saved for pasting)
D Delete text after current cursor position (saved for pasting)
p Paste text that was deleted
j Move up through history commands
k Move down through history commands
u Undo

viewtopic.php?f=165&t=480629
我的意思是想在这个需求中用"Ctrl+Shift+R"代替"Ctrl+S"
Thu Sep 22 00:55:53 CST 2016补充:
但我没有找到"Ctrl+Shift"前缀的绑定方法


_________________
Linux桌面优化综合贴[2017.09.18](欢迎各位补充或指正误区)
[2016.03.10]会C语言但看不懂英文文档的点这里,一个用C语言编写的简陋学习工具
单硬盘通过iso文件实机安装Debian的方法
重启或操作fcitx时失去响应的一个解决方法,不妨试试看


页首
 用户资料  
 
6 楼 
 文章标题 : Re: Ubuntu用户,你们能用"Ctrl+Shift+R"搜索命令行历史?(Bash可以如此绑定?)
帖子发表于 : 2016-09-22 11:08 
头像

注册: 2011-03-20 13:12
帖子: 4521
地址: 山东省寿光县
系统: Debian
送出感谢: 105
接收感谢: 997
科学之子 写道:
这意思就是根本没法用"Ctrl+Shift+R"?

在 Ubuntu GNOME 的 gnome-terminal 中测试 C-r 和 C-S-r 均发送 ^R

科学之子 写道:
那个说Ubuntu能用的是怎么回事呢?

在 Ubuntu GNOME 中 i-search 默认绑定为 C-s


_________________
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户



_________________
评价: 3.7% 科学之子
 
页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 6 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 2 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译