やりたいこと
- 文字入力時に直近の履歴を表示させたい
準備
インストール
zshとoh-my-zshを使った二種類の方法を紹介します
zsh
-
zsh-autosuggestions
をクローン (ここでは~/.zsh/zsh-autosuggestion
へ)
% git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
-
~/.zshrc
に以下を記入
.zshrc
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
- 設定を更新
% source ~/.zshrc
Oh My Zsh
-
$ZSH_CUSTOM/plugins
にzsh-autosuggestions
をクローン -
$ZSH_CUSTOM
はデフォルトだと~/.oh-my-zsh/custom
% git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
-
.zshrc
のpluginsにzsh-autosuggestions
を追記
~/.zshrc
plugins=(
git,
zsh-autosuggestions
)
- 設定を更新
% source ~/.zshrc
使い方
~/.zshrc
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=5'
参考