Refactor Templates with vim-partial


If you're a web developer one chore you might be familiar with is extracting reusable chunks from big templates into smaller files. The vim-partial (GitHub: jbgutierrez/vim-partial) plugin by Javier Blanco GutiƩrrez automates the process by creating a new file based on a selection and inserting the necessary include line.

Some existing plugins do this, but they're typically tied to a specific language or framework. This project is more generic and configurable -- it understands how to extract things like ejs, stylus, erb, and haml, but you can extend it by setting g:partial_templates. You can also change where the output files are stored with g:partial_templates_roots, and you can even make it show the new file in a split window.

blog comments powered by Disqus