How to enable version control in Ranger

Ranger can show the version control status of files and directories. Symbols are displayed in colors along the right side, beside the file size, to indicate the version control status of those files. For example, a green tick mark is shown if the file is up-to-date. Version control systems that are supported include Git, Mercurial (Hg) and Bazaar.

The version control feature is only available in Ranger v1.6.1 and later. If the version from your distribution is older than this, then you need to get the latest version.

Install latest version

  • Before installing the latest version of Ranger, I remove the old one:
$ sudo apt remove ranger
  • Install the latest version of Ranger as described here.

Configure version control feature

  • To enable version control support, have this line in your ~/.config/ranger/rc.conf:
set vcs_aware true
  • Next we need to specify which version control systems we want to be supported. For each version control system, are three possible options: disabled, local (use only local information) and enabled (get remote information too).

For example, to enable Git and Mercurial support with only local information, I add this to rc.conf:

set vcs_backend_git local
set vcs_backend_hg local

Open Ranger now in a directory that is inside any repository and you will see the file status information displayed at the right side of the column.

  • I found that having VCS enabled made Ranger extremely slow to start. So, I disabled it by default and instead mapped a keyboard shortcut zg to enable it when I needed it. This can be done by adding these lines to rc.conf:
set vcs_aware false
map zg set vcs_aware true

Tried with: Ranger 1.7.2 and Ubuntu 14.04

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.