LoginSignup
5
0

More than 3 years have passed since last update.

Preztoで自動補完を有効にして色を変える方法

Posted at

Zsh の自動補完プラグイン zsh-autosuggestions が便利そうで使いたいと思いました。
私は Prezto を使っているので、調べたら autosuggestions というモジュールが最初からあったので、そちらを使うことにしました。

自動補完を有効にする

autosuggestions を有効にするには、.zpreztorc のモジュールを設定している箇所に 1 行追加するだけでできました。

.zpreztorc
# Set the Prezto modules to load (browse modules).
# The order matters.
zstyle ':prezto:load' pmodule \
  'environment' \
  'terminal' \
  'editor' \
  'history' \
  'directory' \
  'spectrum' \
  'utility' \
  'completion' \
  'prompt' \
  'autosuggestions'
# ↑これ!

これで入力が補完されるようになりました。

補完された部分の色を変える

これだけだと補完された部分が、入力した部分と同じ色で分かりづらいので変えたいと思います。
この設定のしかたが分かりづらかったです。
.zpreztorc に以下のコメントがあるので、コメントを外せば何らかの色になるのかと思ったんですが変わりませんでした。

.zpreztorc
# Set the query found color.
# zstyle ':prezto:module:autosuggestions:color' found ''

zstyle の設定のしかたも調べてみたんですがよくわからない……。
他の設定を読んで分かったんですが、'' の部分に以下のように色を設定すればいいみたいです。

.zpreztorc
# Set the query found color.
zstyle ':prezto:module:autosuggestions:color' found 'fg=white'

これで補完された部分が白い文字になるようになりました。

5
0
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
5
0