Reputation: 1665
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.
Upvotes: 53
Views: 118666
Reputation: 1
If you are looking to mirror the key behavior that is used in terminal.app (e.g. tab to autocomplete, opt+arrow to jump words, etc.) you can achieve this in the Profile pane of the settings.
Go to the Key Mapping tab in Settings > Profiles > Keys and choose "Terminal.app Compatibility" from the presets in the lower left corner.
Upvotes: 0
Reputation: 401
Steps to add a keybinding for the TAB key:
In column Action click on "Select Menu Item", and then on the next dropdown select "Open Autocomplete" under the session section.
I changed it using these settings:
Upvotes: 38
Reputation: 124
Anyone looking for the answer when using zsh
, add autoload -Uz compinit && compinit
to your .zshrc
file.
open ~/.zshrc
or
nano ~/.zshrc
or if you are feeling lazy
echo 'autoload -Uz compinit && compinit' >> ~/.zshrc && . ~/.zshrc
Upvotes: 0
Reputation: 81
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
Upvotes: 7
Reputation: 183
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)
Upvotes: 15
Reputation: 724
In Iterm 2 , you can activate Autocomplete by pressing command ⌘
+ ;
Upvotes: 21
Reputation: 9179
You can install bash-completion
package to autocomplete by Tab key.
Upvotes: 23