mCs
mCs

Reputation: 2921

Powerline not work in vim

Ubuntu 16.04 installed sudo apt-get install powerline and added to .bashrc:

# Powerline
if [ -f /usr/share/powerline/bindings/bash/powerline.sh ]; then
        source /usr/share/powerline/bindings/bash/powerline.sh
fi

And added in ~/.vimrc the:

" Powerline
set rtp+=/usr/share/powerline/bindings/vim/

" Always show statusline
set laststatus=2
" Use 256 colours (Use this setting only if your terminal supports 256  colours)
set t_Co=256
let g:Powerline_symbols = "fancy"

when running again eg. vim ~/.vimrc there is no powerline nice status as here: https://www.2daygeek.com/wp-content/uploads/2017/06/install-powerline-in-linux-4.png

How can I fix this to get this fancy line in the bottom?

Upvotes: 3

Views: 6916

Answers (2)

mCs
mCs

Reputation: 2921

The problem is that apt-get is not installing bindings for vim. Use the pip installations instructions as explained:

  1. $ sudo apt-get install python-pip git
  2. $ sudo pip install git+git://github.com/Lokaltog/powerline
$ 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: [email protected]
License: MIT
Location: /usr/lib/python2.7/site-packages
Requires: 
  1. Append to .bashrc
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
  1. $ source ~/.bashrc

Details from here: https://www.2daygeek.com/powerline-adds-powerful-statusline-to-vim-bash-tumx-in-ubuntu-fedora-debian-arch-linux-mint/

Upvotes: 3

Gregory Martin
Gregory Martin

Reputation: 599

Just so no one wastes their time here (like I did). If you install from a a distro's repo (like apt-get) like the OP, then simply add the following 3 lines above your existing lines in your /etc/vim/vimrc:

python from powerline.vim import setup as powerline_setup
python powerline_setup()
python del powerline_setup

Make it "python3" if you are using Python3 instead.

Source I found this in was the powerline documentation. However, the instructions are for installs from pip (but work here as well because its all just python anyway).

https://powerline.readthedocs.io/en/latest/usage/other.html#vim-statusline

Upvotes: 6

Related Questions