LoginSignup
13
10

More than 5 years have passed since last update.

zshにpowerlineを適用させる

Posted at

環境

  • Mac
  • zsh
  • iTerm
  • プラグイン管理:zplug

説明しないこと

  • zplugのインストール方法
  • pythonのインストール方法

zplugの導入に関してはこちらをご確認ください。

powerlineとは

ターミナルの表示をかっこよくするプラグイン
公式にgifが載っているので、見てみてください

インストール

powerline install

$ pip install psutil
$ pip install powerline-shell

fonts install

$ git clone https://github.com/powerline/fonts.git && cd fonts && ./install.sh

iTermのPreferencesを開き、textを変更します。
image.png

「Font」から「Change Font」をクリックし、右上の検索窓より「powerline」と入力しましょう。
image.png

その中から適当なのを選んでおきます。
「Use a different font for non-ASCII text」というチェックボックスはチェックを外しておきます。

.zshrcを編集

zplug "b-ryan/powerline-shell"

function powerline_precmd() {
    PS1="$(powerline-shell --shell zsh $?)"
}

function install_powerline_precmd() {
  for s in ${precmd_functions[@]}; do
    if [ "$s" = "powerline_precmd" ]; then
      return
    fi
  done
  precmd_functions+=(powerline_precmd)
}

if [ "$TERM" != "linux" ]; then
    install_powerline_precmd
fi

.zshrcに以上の記述を加え、source .zshrcでpowerlineを適用出来るようになります。

13
10
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
13
10