If you use ranger, the console-based file manager, you can benefit of its plugin system to get it easily entangled with git-annex. As far as I know, there 2 main types of extensions:

Custom commands

ranger lets you define custom commands that can be called. Basically you could easily write proxy ranger commands for all git-annex commands you use. Here have written

  • :ga_whereis for outputting whereis information;
  • :ga_set and :ga_tag for metadata changing;
  • :ga_get and :ga_drop for quick fetching from remotes and dropping them from local (really useful).

Linemodes

The small string of information that shows on each file line, aligned to the right, is called a infostring. Linemodes in ranger lets you change between its default linemodes or add your own custom linemodes. I have written two git-annex linemodes:

  • git-annex-metadata, which shows tags and metadata fields from git-annex; and
  • git-annex-whereis, which shows the name of the repositories where each file is (except the current repository, as that should be clear from the ranger colours).

To switch linemodes, just type :linemode git-annex-whereis or :linemode git-annex-metadata.

You can also set default_linemode path=/your/annex/path/.* git-annex-whereis, for example, to have that linemode automatically set whenever you browse your git-annex folder on ranger.

Beware of folders with too many files, as this will read output from git-annex for all the files, so ranger can freeze for some seconds.


As I didn't have any better place to put the code, eveything here is referenced in my dotfiles repository on GitHub. Just copy the two referenced files to your ~/.config/ranger/plugins/ folder and ~/.config/ranger/commands.py file to get this working.

Much other interesting commands and plugins can still be added. Modify this page if you come up with other ideas.