ubuntu tab 自动补全失效

2021/10/27 7:12:44

本文主要是介绍ubuntu tab 自动补全失效,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

现象

没有修改.bashrc文件,共用一台机器的小伙伴也没有对系统的bashrc文件的进行修改。tab的自动补全功能莫名其妙的失效。

使用tab自动补全时,显示如下内容(仅粘贴部分内容)

+ _init_completion
+ local exclude= flag outx errx inx OPTIND=1
+ getopts n:e:o:i:s flag
+ COMPREPLY=()
+ local 'redir=@(?([0-9])<|?([0-9&])>?(>)|>&)'
+ _get_comp_words_by_ref -n '<>&' cur prev words cword
+ local exclude flag i OPTIND=1
+ words=()
+ local cur cword words
+ upargs=()
+ upvars=()
+ local upargs upvars vcur vcword vprev vwords
+ getopts c:i:n:p:w: flag -n '<>&' cur prev words cword
+ case $flag in
+ exclude='<>&'
+ getopts c:i:n:p:w: flag -n '<>&' cur prev words cword
+ [[ 6 -ge 3 ]]
+ case ${!OPTIND} in
+ vcur=cur
+ let 'OPTIND += 1'
+ [[ 6 -ge 4 ]]
+ case ${!OPTIND} in
+ vprev=prev
+ let 'OPTIND += 1'
+ [[ 6 -ge 5 ]]
+ case ${!OPTIND} in
+ vwords=words
+ let 'OPTIND += 1'
+ [[ 6 -ge 6 ]]
+ case ${!OPTIND} in
+ vcword=cword
+ let 'OPTIND += 1'
+ [[ 6 -ge 7 ]]
+ __get_cword_at_cursor_by_ref '<>&' words cword cur
+ words=()
+ local cword words
...

问题测试

在网上搜索到使用命令env -i bash --noprofile --norc, 进行测试,查看tab自动补全是否可以使用。
tab键可正常使用, env -i bash --norc尝试使用该命令,tab自动补全已经可以正常使用。

解决办法

使用env -i bash设置bash, tab补全功能可正常使用了

ps

使用的tmux开了多个终端,不知道是不是tmux的问题。

参考
[1] https://itectec.com/ubuntu/ubuntu-no-tab-completion-with-asterisk/



这篇关于ubuntu tab 自动补全失效的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程