O'Reilly logo

Mastering Vim by Ruslan Osipov

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

Housekeeping

So far, we've had our plugin all within one file. Let's see how we can break it down into multiple files to keep our newly created project organized! Give a look at the list in Plugin layout section of this chapter.

First, you can see that the ftplugin/ directory contains filetype-specific plugin configuration. Right now, most of our plugin is actually pretty independent from working with Python, except for the s:comment_string variable. Let's move it out to <...>/vim-commenter/ftplugin/python.vim:

" String representing inline Python comments.let g:commenter#comment_str = '# '

We've changed the scope from s: to g: (since the variable is now used in different scripts), and added the commenter# namespace to avoid namespace collision. ...

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