gogoWebsite

How to configure the terminal of MAC to automatically complete the command line and ignore upper and lower case

Updated to 2 days ago

What should I do if I can't remember the name when typing a command in the terminal or studio? Use the tab to automatically complete the command, but the mac needs to be configured. Follow the operation and automatically complete the command and ignore the upper and lower case. It's so easy to use.

1. Open the terminal, enter the following command line, and then enter
nano .inputrc
2. Copy the following statement to the file on the open page

set completion-ignore-case on
set show-all-if-ambiguous on
TAB: menu-complete

3. Control + O Save, and press Enter.
Exit editing page: Control + X

Open the terminal again and you should be able to press the tab key to complete the command. If you find that case completion cannot be ignored, use the following method:
1. Enter:
open .zshrc
2. Add the following statement to the open page, then command+s save the file, and then close the file

autoload -Uz compinit && compinit
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*'

3. Execute in the terminal:
source .zshrc

Reopen the terminal and ignore the case completion command. If there is no .zshrc file, you can passvi .zshrccreate.