TranslateProject/sources/tech/20170609 Powerline – A Powerful Statusline Plugin For Vim Bash Terminal.md
2017-06-25 11:08:55 +08:00

5.5 KiB
Raw Blame History

Powerline A Powerful Statusline Plugin For Vim & Bash Terminal

Powerline is a statusline plugin for vim, zsh, bash, tmux, IPython, Awesome, bar, fish, lemonbar, pdb, rc, shell, tcsh, wm, i3 and Qtil. It provides statuslines to applications and make all applications more beautiful. Its written in Python.

Its Extensible and feature rich, written in Python which is very thin and doesnt required any third-party dependencies other than a Python interpreter.

Stable and testable code base which is throughly tested and works fine with Python 2.6+ and Python 3.

Statuslines Originally created exclusively for vim, later the project has evolved to provide statuslines in many Linux applications such as zsh, bash, tmux, IPython, Awesome, i3 and Qtil.

Configuration and colorschemes written in JSON. Its a standard and easy file format that allows user to configure supported applications with Powerlines.

Fast and lightweight, with daemon support for even better performance.

Install pre requisites

Make sure your system should have below pre requisite packages. If no, install before proceeding powerline installation.

For Debian users, use APT Package Manager or Apt-Get Package Manager to install Audit package.

$ sudo apt-get install python-pip git

For openSUSE users, use Zypper Package Manager to install Audit package.

$ sudo zypper install python-pip git

For Fedora users, use dnf Package Manager to install Audit package.

$ sudo dnf install python-pip git

For Arch Linux users, use pacman Package Manager to install Audit package.

$ sudo pacman -S python-pip git

For CentOS/RHEL user, use yum Package Manager to install Audit package.

$ sudo yum install python-pip git

How to install Powerline in Linux

In this article, we are going to show you how to install Powerline. Also show you how to use with Bash, tumx & Vim in Debian and RHEL based systems.

$ sudo pip install git+git://github.com/Lokaltog/powerline

Find the powerline installed location in order to configure with applications.

$ pip show powerline-status
Name: powerline-status
Version: 2.6.dev9999+git.517f38c566456d65a2170f9bc310e6b4f8112282
Summary: The ultimate statusline/prompt utility.
Home-page: https://github.com/powerline/powerline
Author: Kim Silkebaekken
Author-email: kim.silkebaekken+vim@gmail.com
License: MIT
Location: /usr/lib/python2.7/site-packages
Requires: 

Add/Enable Powerline on Bash Shell

Add following lines to your .bashrc file which will enable powerline to base shell by default.

if [ -f `which powerline-daemon` ]; then
  powerline-daemon -q
  POWERLINE_BASH_CONTINUATION=1
  POWERLINE_BASH_SELECT=1
  . /usr/local/lib/python2.7/site-packages/powerline/bindings/bash/powerline.sh
fi

Reload the .bashrc file to take immediate effect to get the powerline in the same window.

$ source ~/.bashrc

Add/Enable Powerline on tmux

Tmux is one of the best terminal emulator that offers multiple window and statusline but is not looks good compare with powerline statusline. Add following line to your .tmux.conf file which will enable powerline to tmux by default. If you dont found .tmux.conf file then create a new one.

# vi ~/.tmuc.conf

source "/usr/local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf"

Add/Enable Powerline on Vim

Vim is one of the favourite text editor for admins. Enable powerline to add more power to vim by adding below lines into .vmrcfile. Make a note, in vim 7.x you may not found the .vmrc file in system so dont worry create a new one and add below lines thats it.

# vi ~/.vmrc

set  rtp+=/usr/local/lib/python2.7/site-packages/powerline/bindings/vim/
set laststatus=2
set t_Co=256


via: http://www.2daygeek.com/powerline-adds-powerful-statusline-to-vim-bash-tumx-in-ubuntu-fedora-debian-arch-linux-mint/

作者: 2DAYGEEK · 译者:译者ID 校对:校对者ID

本文由 LCTT 原创编译,Linux中国 荣誉推出