Home » 2013 » February

Vim essentials: Powerline

I thought it would be nice to start a series of posts on neat tricks and plugins for Vim, called Vim Essentials. I don’t know how often I will do these kind  of posts, but I’ve got a couple in mind already.

This first post I’ll start off with Powerline. A plugin for Vim that gives you a better status bar than the default status bar. Your current mode, filetype and used file format is more clear. See the picture below for an example.



After you download and install Powerline you also need to make sure that your .vimrc/.gvimrc has the following lines:

set laststatus=2   " Always show the statusline
set encoding=utf-8 " Necessary to show Unicode glyphs

Adding these two lines makes sure the status bar is always being shown and the characters used in it can be displayed.

Looking at the screenshots provided by the author of Powerline it should also be possible to display the current Git branch, but I’ve yet to find out how to do so. The version I’ve linked here is deprecated in favor of the Python rewrite, which can be found at

Deleting files in Linux that are x-days old

Since I’m not running a PHP version provided by my distribution I’m responsible for cleaning up old session files myself. Aside from PHP another Perl webapp I run also doesn’t clean up its own session files. Luckily cleaning up these old files is something that’s very easy to do under Linux.

find /tmp/sess_* -mtime +2 -exec rm {} \;

In this example I’m only taking files that are at least 2 days old. Add this to your crontab and your session directory should stay nice and tidy.

vimdiff shorcut keys

I usually use KDiff3 when viewing the differences between files and merging stuff together. But from time to time I’ve found vimdiff to be a nice alternative, especially when I’m logged in through SSH on a server. The problem is I don’t use it that often so I tend to forget the key combinations. So instead I listed them here for future reference.

  • do – diff obtain
  • dp – diff put
  • [c – previous difference
  • ]c – next difference
  • :diffupdate – diff update
  • :syntax off – syntax off
  • zo – open folded text
  • zc – close folded text

Original source: