Powerlineの導入
概要
Powerlineとはshell・vimにちょっとした情報をカッコよく表示してくれるツールです。何よりカッコいい。導入手順はこちらです。
Powerline for Shell
まずはshellからカッコよくしていきます。はじめにpowerline-shell
をクローンします。
$ cd ~
$ git clone https://github.com/milkbikis/powerline-shell
このディレクトリは削除できないのでお好みなところにクローンしてきてください。
次にインストールします。設定を変えたい場合はconfig.py
を変更することでお好みの設定に変更できます。設定変更後は再度install.sh
を実行する必要があります。
$ ./install.sh
これでpowerline-shell.pyが生成されるので、Symlinkを貼ります。
$ ln -s ~/powerline-shell/powerline-shell.py ~/powerline-shell.py
私はzshを使用しているので、zshrc
に設定を以下のように追加します。bash, fishの設定はこちらを参照してください。
# power-shell function powerline_precmd() { PS1="$(~/powerline-shell.py --cwd-max-depth 1 $? --shell zsh 2> /dev/null)" } 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
次にフォントのインストールをします。こちらはREADMEのスクリプトをそのまま実行するだけです。
# clone git clone https://github.com/powerline/fonts.git # install cd fonts ./install.sh # clean-up a bit cd .. rm -rf fonts
こんな感じになりました、カッコいいだけでなく意外に便利です。
Powerline for Vim
次にvimのpowerlineの設定をしていきます。はじめにお使いのvimの環境を確認してください。こちらから条件を確認できます。
私はvim-plugを使っているので.vimrc
に以下のように追加します。
Plug 'powerline/powerline', {'rtp': 'powerline/bindings/vim/'}
フォントもインストール済みなので、以上で設定は終了です。 別のプラグインを使っている方はこちらから確認してみてください。
こんな感じになります。
まとめ
デメリットはshellが少し重くなりますが、カッコいいだけでなく意外にも便利だったので導入してもいいかなと思いました。
リンク
- GitHub - powerline/powerline: Powerline is a statusline plugin for vim, and provides statuslines and prompts for several other applications, including zsh, bash, tmux, IPython, Awesome and Qtile.
- GitHub - banga/powerline-shell: A beautiful and useful prompt for your shell
- GitHub - powerline/fonts: Patched fonts for Powerline users.