1. 程式人生 > >CentOS 7.3安裝配置Powerline

CentOS 7.3安裝配置Powerline

bash vim powerline

一、Powerline簡介及演示環境:

Powerline是一個極棒的Vim編輯器的狀態欄插件,主要用於顯示狀態行和提示信息。

特點:

  • 使用Python編寫,使其更具擴展性且功能豐富

  • 穩定易測的代碼庫,兼容Python 2.6+Python 3

  • 支持多種Linux功能及工具的提示和狀態欄

  • 通過JSON保存配置和顏色方案

  • 快速、輕量級,具有後臺守護進程支持,提供更佳的性能

GitHubhttps://github.com/powerline/powerline

Docshttps://powerline.readthedocs.io/en/latest/

演示環境:

系統:CentOS Linux release 7.3.1611 (Core)

Python版本:系統自帶的2.7.5

Bash版本:系統自帶的4.2.46(1)-release(x86_64-redhat-linux-gnu)

備註:在CentOS 6.9環境中,自帶Bash版本為4.1.2Python版本無論為2.6.62.7.x還是3.6.x都會出現如下錯誤提示

技術分享

二、安裝依賴軟件包:

# yum -y install epel-release git python-pip wget

# pip -V --> pip 8.1.2 from/usr/lib/python2.7/site-packages (python 2.7)

三、安裝Powerline

# pip install git+git://github.com/powerline/powerline

技術分享


四、安裝Powerline字體:

# wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf

# wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf

# mv PowerlineSymbols.otf /usr/share/fonts/

# fc-cache -vf /usr/share/fonts/ //更新系統的字體緩存

# mv 10-powerline-symbols.conf /etc/fonts/conf.d/

五、在Bash中啟用Powerline

# pip show powerline-status //獲取Powerline的安裝位置

技術分享

# find / -name powerline.sh --> /usr/lib/python2.7/site-packages/powerline/bindings/bash/powerline.sh

# vim /etc/profile.d/powerline.sh

powerline-daemon -q

POWERLINE_BASH_CONTINUATION=1

POWERLINE_BASH_SELECT=1

. /usr/lib/python2.7/site-packages/powerline/bindings/bash/powerline.sh

# . /etc/profile.d/powerline.sh

技術分享


六、在Vim中啟用Powerline

# find / -name vim --> /usr/lib/python2.7/site-packages/powerline/bindings/vim

新建文件/root/.vimrc,添加如下代碼至文件/root/.vimrc

# vim /root/.vimrc

set rtp+=/usr/lib/python2.7/site-packages/powerline/bindings/vim

set laststatus=2

set t_Co=256

# . /root/.vimrc

技術分享

技術分享


本文出自 “天道酬勤” 博客,請務必保留此出處http://qiuyue.blog.51cto.com/1246073/1946345

CentOS 7.3安裝配置Powerline