powerline-shellを導入する
iterm に powerline-shell を導入する
ついでに、vscodeのターミナルにも適用する。
設定ファイルなどの配置
ホームディレクトリ以下に、toolsってディレクトリを作って、そこに色々落っことすようにした。
~ ├── .bash_profile ├── .bashrc ├── .config │ └── powerline-shell │ └── config.json └── tools ├── fonts ├── iceberg └── powerline-shell
terminal themeの変更
iTerm2に適用する。
Icebergというカラースキームがおしゃれで好きなので導入する。
$ mkdir -p ~/tools/iceberg $ cd ~/tools/iceberg $ curl -O https://raw.githubusercontent.com/Arc0re/Iceberg-iTerm2/master/iceberg.itermcolors
itermにて、preferences -> colors -> Color Presets... -> importから、iceberg.itermcolorsを選択。 そのあと、Color Presets...から、icebergを選択して適用する。
lsコマンドで、色を付ける場合は、エイリアスを追加。
# .bash_profile alias ls='ls -G'
デフォルトのterminal.appに適用するなら、Iceberg公式からdownloadしたファイルが使える。と思う。
powerline-shellの導入
インストールしてみる。 pythonのバーションは2.7.15。
$ cd ~/tools $ git clone https://github.com/b-ryan/powerline-shell.git $ cd powerline-shell $ python setup.py install
これがインストール後、
$ powerline-shell \[\e[38;5;250m\]\[\e[48;5;240m\] ...
みたいな文字列が出れば成功。
.bashrc と .bash_profile を編集する
それぞれ以下のように追記。
# ~/.bashrc # powerline-shell config function _update_ps1() { PS1="$(powerline-shell $?)\n$ " } if [[ $TERM != linux && ! $PROMPT_COMMAND =~ _update_ps1 ]]; then PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND" fi
# ~/.bash_profile # read bashrc if [ -f ~/.bashrc ] ; then . ~/.bashrc fi
この時点だと、こんな感じになっているはず。
文字化けを直す
powerline/fontsのダウンロード
$ cd ~/tools $ git clone https://github.com/powerline/fonts.git --depth=1 $ cd fonts $ ./install.sh // clean up $ cd .. $ rm -rf fonts
itermのpreferences -> profiles -> Text -> Font -> Change Fontから、Source Code Pro for Powerlineを選択。
これでこんな感じになる。
表示される項目を変える
デフォルトの設定を書き出す
$ mkdir -p ~/.config/powerline-shell && powerline-shell --generate-config > ~/.config/powerline-shell/config.json
ファイルの編集
// ~/.config/powerline-shell/config.json { "segments": [ "virtual_env", - "username", - "hostname", "ssh", "cwd", "git", "hg", "jobs", "root" ] }
以上まで終えると、こんな感じ。
vsCodeのターミナルが文字化けする
settingの書き換えする。
cmd + shift + pから、open setting(JSON)
Jsonを編集
{ .... // powerline-shell "terminal.integrated.fontFamily": "Meslo LG M DZ for Powerline", }
参考
Iceberg
powerline/fonts(gitHub)
気分転換にTerminal.appの配色を変えてみる?暗青系のテーマ「Iceberg」を移植しました
Mac iTerm で iceberg のテーマを使う(qiita)
Powerline-shellでターミナルを改造しよう(qiita)
VS Codeのターミナル上のフォント修正


















