環境
- 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を変更します。
「Font」から「Change Font」をクリックし、右上の検索窓より「powerline」と入力しましょう。
その中から適当なのを選んでおきます。
「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を適用出来るようになります。