2

Why does tab completion only work some of the time in OS X terminal? e.g. cd docuTab

For example, when I'm at /Users/ it works fine. But when I'm at ~/ it doesn't work at all.

Once inside ~/Documents/ it works again. What's the deal? I'm definitely typing enough to remove any ambiguity from the subfolders.

Jawa
  • 3,679

2 Answers2

6

Tab completion is case sensitive.

Your username is usually all lowercase, which is why cd username works in /Users, but not cd docu in ~ — the folder name is Documents, with an uppercase D.

If you want to change this behavior, add the following lines to your ~/.inputrc.

$if Bash
  set completion-ignore-case On
$endif

If you do not have an ~/.inputrc you can create one and add the above with this command:

echo "set completion-ignore-case On" >> ~/.inputrc
ahsteele
  • 1,964
Daniel Beck
  • 111,893
0

Newer versions of MacOS (10.15+) use zsh in the terminal so you will need to configure that instead.

Add these lines to ~/.zshrc:

autoload -Uz compinit && compinit
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'

More info here: https://superuser.com/a/1092328/222897

MarZab
  • 121