LoginSignup
6
0

More than 5 years have passed since last update.

PROMPTで変数が更新されない

Posted at

vcs_info の結果が変わらない

.zshrc に以下のような PROMPT を設定すると,.zshrc 読み込み時からバージョン管理システムの情報が更新されない.

PROMPT="${vcs_info_msg_0_}"

シングルクォート使えばOK

上記のようにダブルクォートを使うと, .zshrc の読み込み時に変数が展開されてしまうため,precmd が呼ばれる等で変数の内容が変わっても更新されない.

よって,以下のようにシングルクォートを使って変数を展開せずに持っておく.

PROMPT='${vcs_info_msg_0_}'

参考

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