title: What is the best strategy for code chunks and macros in vim?
body: <p>As I develop more with vim, I find myself wanting to copy in blocks of useful code, similar to "templates" in Eclipse. </p>
  
  <p>I was thinking of making a separate file for each code chunk and just reading them in with</p>
  
  <pre><code>:r code-fornext
  </code></pre>
  
  <p>but that just seems kind of primitive. Googling around I find vim macros mentioned and something about "maps" but nothing that seems straightforward.</p>
  
  <p>What I am looking for are e.g. something like Eclipse's "Templates" so I pop in a code chunk with the cursor sitting in the middle of it.
  Or JEdit's "Macros" which I can record doing complicated deletes and renaming on one line, then I can play it again on 10 other lines so it does the same to them.</p>
  
  <p>Does vim have anything like these two functionalities?</p>