LoginSignup
2
2

ターミナルにzsh-autosuggestions、zsh-syntax-highlightingプラグインを導入

Last updated at Posted at 2023-05-17

はじめに

zsh-autosuggestions、zsh-syntax-highlightingプラグインの2つが便利ということで使ってみました。

zsh-autosuggestionsとは

コマンド入力のhistoryからサジェストを出してくれるプラグインです。
今まではCtrl + r とpecoプラグインを使ってたから入れる必要性が全くないが、ちょっとした簡単なコマンド入力時にほんの少し便利。

リポジトリ
https://github.com/zsh-users/zsh-autosuggestions

zsh-syntax-highlightingとは

コマンドにシンタックスハイライトがいい感じで効くプラグイン。
設定で色々色周りを変更できるが、デフォルトで使っています。

リポジトリ
https://github.com/zsh-users/zsh-syntax-highlighting

プラグインのインストール

% brew install zsh-autosuggestions
% brew install zsh-syntax-highlighting

プラグインの有効化

zshであればzshrcファイルに下記を記載してプラグインを有効化します

.zshrc
source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh
source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

変更を反映

% source .zshrc

使ってみる

1つ目の文字を入力するとサジェストされています。このコマンドでよければ⇨ボタンで確定。
ハイライトもされています。
スクリーンショット 2023-05-17 17.19.19.png

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2