I have multiple HTML files that form a small website. Several lines of code are duplicated at the top of the files (although the <title>
differs), and a few lines are duplicated at the bottom.
I could use a pre-compiler like Jekyll, and use layouts so I only have to change the code once, but I feel this adds unnecessary complexity to the project. I could use regexes (which is what I'm currently doing, using DirDo.vim), but this is a bit of a hassle.
So, is there any plugin that detects the identical parts of a set of files, and allows you to edit all of them at once? Or are there any other ways of doing this that I might not have thought of?
sed
the stream editor. Sed is a non interactive editor, for batch editing multiple files. Also it is part of the same family asvi
. Having said that I could use a pre-processor, there is a good rule in software “say it only once”, if you find your self saying/writing it more than once, then you need to modularise (function calls, includes, …).