深入浅出了解Linux和MacOS终端大小写敏感问题(附代码)


当前第2页 返回上一页

配置inputrc变量的语法如下:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

keyname: function-name or macro

 

#keyname必须是英文,可以是Control-u、Control-k等。并且keyname和冒号之间不能有空格,如果有空格会被认为是keyname的一部分。keyname的写法多样,取决于自己的喜好。

#下面是一些键盘映射配置的例子:

 

Control-u: universal-argument C-u is bound to the function universal-argument

 

Meta-Rubout: backward-kill-word M-DEL is bound to the function backward-kill-word

 

Control-o: "> output" C-o is bound to run the macro expressed on the right hand side (that is, to insert the text ‘> output’ into the line)

 

Control-j: menu-complete C-j is bound to cycle through the available tab completions.

 

Control-k: menu-complete-backward C-k is bound to cycle backwards through the available tab completions.

 

"\t": menu-complete Use tab to cycle through all the possible completions.

 

"\C-p": history-search-backward Map control-p to allow search for completions to the current line from your history. e.g. type “git” and then hit control-p to cycle through all the recent git commands.

 

"\ep": history-search-backward Map escape-p to allow search for completions to the current line from your history. e.g. type “git” and then hit escape-p to cycle through all the recent git commands.

 

"\e[A": history-search-backward Map Up arrow to allow search for completions to the current line from your history. e.g. type “git” and then hit UP to cycle through all the recent git commands.

 

"\e[B": history-search-forward Map Down arrow to allow search for completions to the current line from your history. e.g. type “git” and then hit DOWN to cycle back through all the recent git commands.

 

"\C-d": kill-whole-line Map control-d to kill the whole line.

设置MacOS下自动补全不区分大小写

通过上面的介绍,解决这个问题应该是绰绰有余了。打开用户主目录下的文件~/.inputrc(如果没有的话,就新建该文件),在其中添加如下配置:

1

2

3

4

# 设置自动补全不区分大小写

set completion-ignore-case on

# 当有一个以上自动补全结果时,直接列出,不用beep提示

set show-all-if-ambiguous on

保存该文件,然后,重启命令行,就会发现自动补全不区分大小写已经生效了。 网上好多结果中,还需要多加一个下面的配置:

1

TAB: menu-complete

这个配置的目的是,在列出自动补全的结果之后,再按一次tab键,就会自动在自动补全列表中选择,而不是一直展示自动补全列表。

推荐学习:Mac OS入门教程、Linux视频教程

以上就是深入浅出了解Linux和MacOS终端大小写敏感问题(附代码)的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

Linux系统下查看网卡信息的命令是什么

Linux如何重装系统

Linux软件是什么?

Linux 下你所不知道的 7 个 ssh 命令用法

教你如何用Linux设置服务器自动重启

Linux中.tar文件怎么解压

Linux文件目录结构

Linux中sed命令和awk命令的使用方法

无法远程连接Linux服务器

Linux文件与目录管理的介绍(附代码)

更多相关阅读请进入《Linux》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...