Adding Mappings
Back in Writing Text to a Buffer, you saw how we can call normal-mode commands from a script. Those are commands like we enter all the time while using Vim—dd to delete a line, j to move down a line, p to paste, and so forth.
We’ve been adding some helpful commands to our plugin, but before we get this out to an actual user, we’ll also want to add mappings to those commands, for something closer to the ultimate in ease of use. We want to be able to say something along the lines of, “Hit Ctrl-x to play the song.” Saying, “Run :PlaySong(3) Enter” doesn’t have quite the same ring to it, does it?
Some of these mappings are going to be usable in our plugin only—and they won’t just be specific to our plugin, but they’re only ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access