Power prompts and vim status bars for devs

Having relevant information in the bash prompt or vim status bar can always help devs. Looking for options, we came across four. There prompts and bars are in general called powerlines. Take your pick!

1. bash-git-prompt

Works in the bash and fish shell. Displays information about the current git repository like the branch name, difference with remote branch, number of files staged, changed, stashed, etc.

To install, run:

$ cd
$ git clone https://github.com/magicmonty/bash-git-prompt.git .bash-git-prompt

To configure, add the following in ~/.bashrc:

GIT_PROMPT_ONLY_IN_REPO=1
source ~/.bash-git-prompt/gitprompt.sh

2. powerline-shell

Works in Bash, ZSH and Fish. Shows the status of version control in a beautiful and colourful prompt. Features:

  • Shows some important details about the git/svn/hg/fossil branch:
    > Displays the current branch which changes background colour when the branch is dirty
    > A ‘+’ appears when untracked files are present
    > When the local branch differs from the remote, the difference in number of commits is shown along with ‘⇡’ or ‘⇣’ indicating whether a git push or pull is pending
  • Changes colour if the last command exited with a failure code
  • Shortens the displayed path with an ellipsis if too deep into the directory tree
  • Shows the current Python virtualenv environment
  • Easy to customize and extend

To install, run:

$ git clone https://github.com/milkbikis/powerline-shell.git
$ cd powerline-shell
$ ./install.py
$ ln -s  ~/powerline-shell.py
$ cd ..
$ git clone https://github.com/powerline/fonts.git
$ cd fonts
$ ./install.sh

Before running the third step above you can edit config.py.dist to config.py to configure segments according to your preference.

Add the following in your ~/.bashrc:

function _update_ps1() {
       export PS1="$(~/powerline-shell.py $? 2> /dev/null)"
}

export PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"

To view the colours, you may need to set $TERM to xterm-256color:

$ export TERM=xterm-256color

3. 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. Features:

  • Extensible and feature rich. Written in Python.
  • Support for prompts and statuslines in many applications
  • Fast and lightweight, with daemon support for even better performance
  • Mode-dependent highlighting
  • Automatic truncation of segments in small windows

To install, run:

$ sudo pip install powerline-status

You also need to install the fonts. Using patched fonts is the easier option. Refer to this section from docs.

4. vim-airline

Another lean status or tabline for vim displaying extra information. One of the main advantages is vimscript based development (no Python). Features:

  • Written with extensibility in mind
  • Integrates with a variety of plugins
  • Looks good with regular fonts and provides configuration points to use unicode or powerline symbols
  • Optimized for speed; it loads in under a millisecond
  • Extensive suite of themes for popular colour schemes
  • Works with vim 7.2 and above
  • Replace all sections with standard statusline syntax
  • Automatic truncation
  • Smarter tab line

To install, run:

$ git clone https://github.com/bling/vim-airline.git
$ cd vim-airline
$ cp -rnv * ~/.vim/

Add the following in your ~/.vimrc to enable airline:

set laststatus=2

Similar software

3 thoughts on “Power prompts and vim status bars for devs”

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s