Difference between revisions of "Powerline"

From ArchWiki
Jump to navigation Jump to search
(Change to Python 3.7)
(Streamlined writing - Moved Alternative Installation types, alternative fonts, alternative package to miscellaneous section. Added tmux usage. Added customizing section.)
Line 6: Line 6:
 
== Installation ==
 
== Installation ==
  
Powerline can be installed in multiple ways, depending on preference and/or usage intent.
+
[[Install]] {{Pkg|powerline}} and {{Pkg|powerline-fonts}} from the [[official repositories]]
 +
 
 +
== Usage ==
 +
=== Bash ===
 +
Add the following to your '''~/.bashrc''':
 +
powerline-daemon -q
 +
POWERLINE_BASH_CONTINUATION=1
 +
POWERLINE_BASH_SELECT=1
 +
. /usr/share/powerline/bindings/bash/powerline.sh
 +
Close and reopen your terminal and it should be working. If not, check the [https://powerline.readthedocs.io/en/latest/usage/shell-prompts.html#bash-prompt Powerline bash prompt] usage instructions to ensure that it has not changed.
  
=== Official repositories ===
+
=== Zsh ===
 +
Add the following to your '''~/.zshrc''':
 +
powerline-daemon -q
 +
. /usr/lib/python3.7/site-packages/powerline/bindings/zsh/powerline.zsh
 +
=== Tmux ===
 +
{{note|Watch out for interfering styles in .tmux.conf (i.e. window-status-format)}}Add the following to your '''~/.tmux.conf''':
 +
source /usr/lib/python3.7/site-packages/powerline/bindings/tmux/powerline.conf
 +
{{note|It is sufficient to just add this to .tmux.conf (adding anything zshrc or bashrc isn't neccessary).}}
  
[[Install]] {{Pkg|powerline}} and {{Pkg|powerline-fonts}} from the [[official repositories]]
+
=== Vim ===
 +
Install {{Pkg|powerline-vim}}
 +
{{Note|If you have more than one version of python installed, add {{ic|let g:powerline_pycmd<nowiki>=</nowiki>"py3"}} or {{ic|let g:powerline_pycmd<nowiki>=</nowiki>"py"}} to your vimrc.}}
 +
{{Tip|By default, the statusline (and therefore Powerline) only appears when there are multiple windows open. To show it all the time, use {{ic|1=:set laststatus=2}}}}
 +
{{Tip|This package installs Powerline to {{ic|/usr/share/vim/vimfiles/plugin}}, which vim is configured to check by default, meaning this will install Powerline in vim for all users and may require additional configuration. If this is not intended, consider either using a vim plugin manager, or installing the {{Pkg|powerline}} package and adding {{ic|set rtp+<nowiki>=</nowiki>/usr/lib/python3.7/site-packages/powerline/bindings/vim}} to your vimrc.}}
 +
=== Detailed Usage ===
 +
For detailed usage instructions, such as configuring your system to use Powerline with other shells, window manager widgets, etc., please refer to the [https://powerline.readthedocs.io/en/latest/usage.html#usage Usage section] of the [https://powerline.readthedocs.io/en/latest/index.html Powerline documentation].
 +
== Customizing ==
 +
To customize powerline, copy a default config to $XDG_CONFIG_HOME/powerline/... Then edit the file to your liking.
 +
 
 +
Example to customize powerline for tmux:
 +
cp /usr/lib/python3.7/site-packages/powerline/config_files/themes/tmux/default.json ~/.config/powerline/themes/tmux/default.json
  
=== Using python-pip ===
+
=Miscellaneous==
 +
=== Alternative Installation ===
 +
==== Using python-pip ====
  
 
* [[Install]] {{Pkg|python-pip}} from the [[official repositories]]
 
* [[Install]] {{Pkg|python-pip}} from the [[official repositories]]
 
* Please refer to the [https://powerline.readthedocs.io/en/master/installation.html Powerline installation guide] for additional python-pip instructions
 
* Please refer to the [https://powerline.readthedocs.io/en/master/installation.html Powerline installation guide] for additional python-pip instructions
  
=== Using a vim plugin manager ===
+
==== Using a vim plugin manager ====
  
 
There are many vim plugin managers available which are able to install and update Powerline, assuming you are using a version of vim with Python support or you install {{Pkg|python}}. For example, using {{AUR|vim-plug}} from the [[AUR]], add the following to your vimrc file:
 
There are many vim plugin managers available which are able to install and update Powerline, assuming you are using a version of vim with Python support or you install {{Pkg|python}}. For example, using {{AUR|vim-plug}} from the [[AUR]], add the following to your vimrc file:
Line 30: Line 59:
  
 
Substitute {{ic|''path/to/vim/plugins/directory''}} with the actual directory, such as {{ic|~/.vim/plugged}}, or {{ic|~/.local/share/nvim/plugged}} for Neovim, and run the vim-plug command {{ic|:PlugInstall}} within vim. This will download Powerline from the [https://github.com/powerline/powerline Powerline GitHub page] to the specified plugin directory and add it to vim.
 
Substitute {{ic|''path/to/vim/plugins/directory''}} with the actual directory, such as {{ic|~/.vim/plugged}}, or {{ic|~/.local/share/nvim/plugged}} for Neovim, and run the vim-plug command {{ic|:PlugInstall}} within vim. This will download Powerline from the [https://github.com/powerline/powerline Powerline GitHub page] to the specified plugin directory and add it to vim.
 +
=== Alternative Fonts ===
 +
A reduced set of fonts for the text console are available in {{aur|powerline-console-fonts}}.
  
=== Fonts ===
+
=== Alternative Package ===
Powerline uses special glyphs and symbols that will not appear correctly unless they are added to fontconfig or patched fonts are installed and used. The fontconfig and some patched fonts are available in the {{Pkg|powerline-fonts}} package from the [[official repositories]]. A reduced set of fonts for the text console are available in {{aur|powerline-console-fonts}}.
 
 
 
=== Airline-vim alternative ===
 
  
 
There is currently one known alternative to Powerline - [https://github.com/vim-airline Vim-airline]. It is a part of {{Grp|vim-plugins}} and can be installed separately as {{Pkg|vim-airline}}. Optionally, install {{Pkg|vim-airline-themes}}.
 
There is currently one known alternative to Powerline - [https://github.com/vim-airline Vim-airline]. It is a part of {{Grp|vim-plugins}} and can be installed separately as {{Pkg|vim-airline}}. Optionally, install {{Pkg|vim-airline-themes}}.
 
=== Special plugins ===
 
Depending on where you want to use Powerline, you might need to install additional packages.
 
;[[Vim]]: {{Pkg|powerline-vim}}
 
After installing the package, you may need to add {{ic|let g:powerline_pycmd<nowiki>=</nowiki>"py3"}} or {{ic|let g:powerline_pycmd<nowiki>=</nowiki>"py"}} to your vimrc if you have more than one version of python installed.
 
{{Tip|By default, the statusline (and therefore Powerline) only appears when there are multiple windows open. To show it all the time, use {{ic|1=:set laststatus=2}}}}
 
{{Tip|This package installs Powerline to {{ic|/usr/share/vim/vimfiles/plugin}}, which vim is configured to check by default, meaning this will install Powerline in vim for all users and may require additional configuration. If this is not intended, consider either using a vim plugin manager, or installing the {{Pkg|powerline}} package and adding {{ic|set rtp+<nowiki>=</nowiki>/usr/lib/python3.7/site-packages/powerline/bindings/vim}} to your vimrc.}}
 
 
== Usage ==
 
=== Bash ===
 
After installing {{Pkg|powerline}} and {{Pkg|powerline-fonts}}. Add the following to your '''~/.bashrc''':
 
powerline-daemon -q
 
POWERLINE_BASH_CONTINUATION=1
 
POWERLINE_BASH_SELECT=1
 
. /usr/share/powerline/bindings/bash/powerline.sh
 
Close and reopen your terminal and it should be working. If not, check the [https://powerline.readthedocs.io/en/latest/usage/shell-prompts.html#bash-prompt Powerline bash prompt] usage instructions to ensure that it has not changed.
 
 
=== Zsh ===
 
After installing {{Pkg|powerline}} and {{Pkg|powerline-fonts}}. Add the following to your '''~/.zshrc''':
 
powerline-daemon -q
 
. /usr/lib/python3.7/site-packages/powerline/bindings/zsh/powerline.zsh
 
 
=== Other plugins ===
 
For detailed usage instructions, such as configuring your system to use Powerline with other shells, window manager widgets, etc., please refer to the [https://powerline.readthedocs.io/en/latest/usage.html#usage Usage section] of the [https://powerline.readthedocs.io/en/latest/index.html Powerline documentation].
 

Revision as of 02:55, 7 September 2018

Powerline is a statusline plugin for Vim, and provides statuslines and prompts for several other applications, including zsh, bash, tmux, IPython, Awesome, i3 and Qtile.

Installation

Install powerline and powerline-fonts from the official repositories

Usage

Bash

Add the following to your ~/.bashrc:

powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
. /usr/share/powerline/bindings/bash/powerline.sh

Close and reopen your terminal and it should be working. If not, check the Powerline bash prompt usage instructions to ensure that it has not changed.

Zsh

Add the following to your ~/.zshrc:

powerline-daemon -q
. /usr/lib/python3.7/site-packages/powerline/bindings/zsh/powerline.zsh

Tmux

Note: Watch out for interfering styles in .tmux.conf (i.e. window-status-format)

Add the following to your ~/.tmux.conf:

source /usr/lib/python3.7/site-packages/powerline/bindings/tmux/powerline.conf
Note: It is sufficient to just add this to .tmux.conf (adding anything zshrc or bashrc isn't neccessary).

Vim

Install powerline-vim

Note: If you have more than one version of python installed, add let g:powerline_pycmd="py3" or let g:powerline_pycmd="py" to your vimrc.
Tip: By default, the statusline (and therefore Powerline) only appears when there are multiple windows open. To show it all the time, use :set laststatus=2
Tip: This package installs Powerline to /usr/share/vim/vimfiles/plugin, which vim is configured to check by default, meaning this will install Powerline in vim for all users and may require additional configuration. If this is not intended, consider either using a vim plugin manager, or installing the powerline package and adding set rtp+=/usr/lib/python3.7/site-packages/powerline/bindings/vim to your vimrc.

Detailed Usage

For detailed usage instructions, such as configuring your system to use Powerline with other shells, window manager widgets, etc., please refer to the Usage section of the Powerline documentation.

Customizing

To customize powerline, copy a default config to $XDG_CONFIG_HOME/powerline/... Then edit the file to your liking.

Example to customize powerline for tmux:

cp /usr/lib/python3.7/site-packages/powerline/config_files/themes/tmux/default.json ~/.config/powerline/themes/tmux/default.json

Miscellaneous=

Alternative Installation

Using python-pip

Using a vim plugin manager

There are many vim plugin managers available which are able to install and update Powerline, assuming you are using a version of vim with Python support or you install python. For example, using vim-plugAUR from the AUR, add the following to your vimrc file:

~/.vimrc
call plug#begin('path/to/vim/plugins/directory')

Plug 'powerline/powerline'

call plug#end()

Substitute path/to/vim/plugins/directory with the actual directory, such as ~/.vim/plugged, or ~/.local/share/nvim/plugged for Neovim, and run the vim-plug command :PlugInstall within vim. This will download Powerline from the Powerline GitHub page to the specified plugin directory and add it to vim.

Alternative Fonts

A reduced set of fonts for the text console are available in powerline-console-fontsAUR.

Alternative Package

There is currently one known alternative to Powerline - Vim-airline. It is a part of vim-plugins and can be installed separately as vim-airline. Optionally, install vim-airline-themes.