Vim Keybindings in ncmpcpp

Because taking your hand off the homerow sucks

If You’re New to ncmpcpp

ncmpcpp is a client for mpd which is a music player daemon. You set up mpd, you set up ncmpcpp, and you’re off to the races. As usual, the ArchWiki has excellent guides for both ncmpcpp and mpd.

The Problem

To have ncmpcpp use our bindings we need to simply edit the bindings file. All you have to do is copy /usr/share/doc/ncmpcpp/bindings to ….

Well, that’s where this gets slightly annoying. By default ncmpcpp expects all of its configuration files to be in ~/.ncmpcpp, which would be great if ncmpcpp was last updated seven years ago, before the XDG Base Directory Specification was created, but for a project that has had six issues opened about it, this is a bit disheartening.

The worst part is that ncmpcpp will look for the config file in the correct location, usually ~/.config/ncmpcpp/config, but not for the keybindings file. What gives?

Actually Changing the Bindings

Rather than bother to look for the documentation just look at /usr/share/doc/ncmpcpp/bindings, since that’s all the documentation anyway. Here is all you need for simple hjkl movement:

def_key "l"
  next_column
def_key "h"
  previous_column
def_key "k"
  scroll_up
def_key "j"
  scroll_down

The Solution

I recommend that you put both the config and bindings files in ~/.config/ncmpcpp/, since that’s where they’re supposed to go. But now we need some way to tell ncmpcpp where the bindings are since it’s so confused.

One way to do this is to simply specify the path to the bindings file every time you start it up, by using the -b flag like so:

ncmpcpp -b ~/.config/ncmpcpp/bindings

I’m way too lazy^H^H^H^H busy to be typing that every time I want to start ncmpcpp, so I use a bash alias to speed things up:

# Force ncmpcpp to use sane bindings
alias ncmpcpp='ncmpcpp -b .config/ncmpcpp/bindings'

TL;DR

ncmpcpp doesn’t uses the standard $XDG_CONFIG_DIR for its bindings, so you need to manually specify the location using a flag.