'How to make iTerm autocomplete a partial command when pressing the 'up' arrow key? [closed]
I currently have iTerm version 3.4.12.
In my old work computer I had a different version that would autocomplete a partial command based on the previous commands I had typed when pressing the up key, for example if at some point I ran:
cd Desktop
And then I went back to the folder where I ran it and tried typing
cd De
Followed by pressing the up key it would autocomplete to cd Desktop
Now I'm on a different computer and pressing the up key simply goes through the history of commands I've ran regardless of the folder I'm in or what I've typed, how can I make it so it autocompletes paritially based on my history instead?
Solution 1:[1]
Brief
Hi, actually this is what are you looking for oh-my-zsh.
It's a really complete framework for zsh
that brings a lot of functionality and the capability to add external plugins.
Installation
- Execute the following in your terminal
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
- it should updated your
~/.zshrc
file with a bunch of stuff including some default useful plugin, you can restart your terminal or resource the configuration file just typing
$ zsh
Plugins
You can find other external plugin like zsh-autosuggestions
, this actually brings you an autocomplete
feature during the typing phase
To Install this as other plugin you can follow this
- Open your .zshrc configuration file inside your terminal
$ vi ~/.zshrc
Note
if vi does not work try to use nano
or vim
instead, if you don't have even nano you can just open the file via GUI using any text editor
Inside the configuration file, find the
plugin
section, and inside the round brackets addzsh-autosuggestions
# Which plugins would you like to load? # Standard plugins can be found in ~/.oh-my-zsh/plugins/* # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. plugins=( git bundler dotenv osx rake zsh-autosuggestions last-working-dir web-search brew extract history sudo yarn )
Restart your terminal and you should be done! For more information you can find the github repo of oh-my-zsh
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | mikrowdev |