安装 Powerline
首先确保已安装python和pip。可通过pip或git等工具安装,这里使用pip安装:
pip install powerline-status
配置powerline到bash
安装后查找powerline的安装位置:
pip show powerline-status
记录下Location的路径
Name: powerline-status
Version: 2.6
Summary: The ultimate statusline/prompt utility.
Home-page: https://github.com/powerline/powerline
Author: Kim Silkebaekken
Author-email: [email protected]
License: MIT
Location: /usr/local/python3.5.3/lib/python3.5/site-packages
在~/.bashrc中添加
powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
. /usr/local/python3.5.3/lib/python3.5/site-packages/powerline/bindings/bash/powerline.sh
重新读取~/.bashrc文件
source ~/.bashrc
如无意外,可以看到 Powerline 终端界面。这里也有可能出现“powerline/bindings/bash/../../../scripts/powerline-config:: No such file or directory”的报错。原因没有将powerline的相关命令添加到环境变量,可以使用软链接解决
ln -s /usr/local/python3.5.3/bin/powerline /usr/local/bin
ln -s /usr/local/python3.5.3/bin/powerline-config /usr/local/bin
ln -s /usr/local/python3.5.3/bin/powerline-daemon /usr/local/bin
配置powerline到vim
在~/.vimrc 文件中加入
set rtp+=/usr/local/python3.5.3/lib/python3.5/site-packages/powerline/bindings/vim
set laststatus=2
set t_Co=256
用vim 打开文件就可以看到powerline提供的状态条了。