Improving our plugin

There are many paths we can take our plugin in, but let's focus on two main issues we have right now:

  • Our plugin fails with spectacular errors when we try to execute it in any other language
  • The plugin does not provide a way to operate on multiple lines at once

Let's start with the first problem: making the plugin work across different languages. Right now, if you try to execute the plugin in, for example, a .vim file, you'll get the following volley of errors:

That's because we define g:commenter#comment_str in <...>/vim-commenter/ftplugin/python.vim, and the variable is only defined when we're working with a Python ...

Get Mastering Vim now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.