O'Reilly logo

The VimL Primer by Benjamin Klein

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required