Le Bagage, Gautier Pelloux-Prayer

You are here:   Home > Welcome > Bash - autocomplete & menu selection


Bash - autocomplete & menu selection

  • Issue : how can we do give zsh behaviour to bash meaning TAB smart key.  Just try it out, and you'll like it Clin d'œil.
  • Features :
Command me.rincevent:~ : ls
automate  bin  Desktop  public_html  sauvegarde  travail  zsh-4.3.6-70.23.i586.rpm
Command me.rincevent:~ : cd d[TAB] --> 
Command me.rincevent:~ : cd Desktop
Command me.rincevent:~ : gen[TAB]
gencat         genhomedircon  genhostid      genisoimage    
Command me.rincevent:~ : gencat[TAB]
Command me.rincevent:~ : genhomedircon
  • Solution :

If you got root privileges:

1. Install bash-completion

2. Insert into ~/.bashrc :

if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi

3. Finally in ~/.inputrc :

 

set completion-ignore-case on
set show-all-if-ambiguous on
set show-all-if-unmodified on
"\C-i": menu-complete

Else you need to (adjust MPP to your own path) :

1. Install manually bash-completion (cf this ticket)

2. Edit these lines from bash_completion. Don't forget to replace MPP (absolute path) :

MPP=/home/toto/bash-completion
[ -n "$BASH_COMPLETION" ] || BASH_COMPLETION=$MPP/etc/bash_completion
[ -n "$BASH_COMPLETION_DIR" ] || BASH_COMPLETION_DIR=$MPP/etc/bash_completion.d
[ -n "$BASH_COMPLETION_COMPAT_DIR" ] || BASH_COMPLETION_COMPAT_DIR=$MPP/etc/bash_completion.d

3. Then in ~/.bashrc :

if [ -f /home/toto/bash-completion/etc/bash_completion ]; then
   . /home/toto/bash-completion/etc/bash_completion
fi

 4. Finally, insert in ~/.inputrc :

set completion-ignore-case on
set show-all-if-ambiguous on
set show-all-if-unmodified on
"\C-i": menu-complete

 

That's all folks !