[英]Single key shortcut to search in OS X Terminal
One of my favorite options in OS X Terminal is searching through previously typed commands. OS X Terminal中我最喜欢的选项之一是搜索以前键入的命令。 I use it a lot. 我经常使用。 What I don't like about it is the shortcut, it's ctrl + R . 我不喜欢它的快捷方式是ctrl + R。 In modern notebooks, ctrl is not placed to be found immediately. 在现代笔记本电脑中, ctrl不能立即找到。 I would love to use single key to start searching, maybe tab on empty prompt could do the trick? 我很乐意使用单键开始搜索,也许在空提示上的选项卡可以解决这个问题? It's useless anyway. 反正没用。
I'm using OS X Yosemite. 我正在使用OS X Yosemite。
Simple: You can add the following to your .profile
/ .bashrc
/ .bash_profile
: 简单:您可以将以下内容添加到.profile
/ .bashrc
/ .bash_profile
:
bind [key]:reverse-search-history
For example, 例如,
bind '`':reverse-search-history
to bind the backtick key (above Tab on a US keyboard) to the search history function. 将反引号键(美国键盘上的Tab键上方)绑定到搜索历史记录功能。 (Note that shift-backtick to get tilde will still work normally, and you can use $()
in virtually every context that normally requires the backtick). (请注意,使用shift-backtick来获得代字号仍然可以正常工作,并且您实际上可以在通常需要反引号的每个上下文中使用$()
)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.