29
votes

Let's say I'm in my root directory, and I have a User folder that I can cd into. In my default Mac terminal, I can just type cd U + tab, and it autocompletes to cd Users/. How do I get this to work in iTerm2?

It used to work just fine in iTerm2, but I must have changed a setting somewhere that disabled it, and I cannot figure out how to get it back.

6

6 Answers

54
votes

Autocomplete in iTerm2 activates by pressing cmd + ;

16
votes

You can install bash-completion package to autocomplete by Tab key.

12
votes

In Iterm 2 , you can activate Autocomplete by pressing command ⌘ + ;

Autocomplete

12
votes

cmd + , - to enter preferences

click on keys tab

click on + in bottom left

click on area to record key and click tab key

then for the action click on select meny item and then on the next drop down select open autocompelte under the session section

I changed it using these settings:

screenshot

2
votes

Autosuggestions while you type a command in Iterm2 (I believe this is what you where referring to)

Git Clone the zsh-autosuggestions plugin in the OhMyZsh plugin folder. (or just brew install it if on Mac)

$ sudo git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

Once that is done, add the plugin in the ~/.zshrc file's plugin list.

plugins=(zsh-autosuggestions)
1
votes

You can also enable Auto Command Completion (View > Auto Command Completion) which shows a window with command completion suggestions as you type. You'll have to have shell-integration enabled first, otherwise it will be greyed out in the menu bar.

https://iterm2.com/documentation-shell-integration.html