Blog is moving

My blog is moving to http://victormendonca.com/blog/. If you are looking for a specific or older post you are in the right place Otherwise check out my new page for more up to date content.

Wednesday, September 20, 2017

Additional Status for VIM with Powerline

Would you like to have more information displayed while reading files in VIM? Powerline is a great utility for that.
Imgur
In it's default config, it displays:
  • Current mode (normal, insert, visual)
  • Git branch
  • File name
  • File encoding
  • Script type
  • File view percentage
  • Line number
To install it on Arch:
sudo pacman -Ss python-powerline powerline powerline-vim
Add the line below to your ~/.vimrc
set laststatus=2

Note: If you get the error below
Traceback (most recent call last):
  File "", line 9, in 
ImportError: No module named powerline.vim
An error occurred while importing powerline module.
This could be caused by invalid sys.path setting,
or by an incompatible Python version (powerline requires
Python 2.6, 2.7 or 3.2 and later to work). Please consult
the troubleshooting section in the documentation for
possible solutions.
If powerline on your system is installed for python 3 only you
should set g:powerline_pycmd to "py3" to make it load correctly.
Unable to import powerline, is it installed?
Press ENTER or type command to continue
Modify either ~/.vimrc (or /etc/vimrc if you want the fix available for multiple users) by adding the line below:
let g:powerline_pycmd = 'py3'

No comments: