title: Searching for string while recording a macro in VIM
body: <p>I want to add a new field to objects in a list using vim. Each object is not the same number of lines. However, the last field is the same for each object. </p>
  
  <p>The new field is the same for each object, so I figured I could create a vim macro that would insert the static field at the end of each object, as well as inserting a comma on the preceding line. My problem is that I am unable to perform a string search within the macro recorder, though.</p>
  
  <p>Here's an example of what I'm trying to accomplish:</p>
  
  <p><code>Input:
  [
    {
      "prop1": 10,
      "prop2": 30,
      "last": 99
    },
    {
      "prop1": 80,
      "last": 10
    },
    {
      "propA": 33,
      "propB": 90,
      "propC": 38,
      "last": 100
    }
  ]
  </code></p>
  
  <p><code>Desired Output:
  [
    {
      "prop1": 10,
      "prop2": 30,
      "last": 99,
      "new": 0
    },
    {
      "prop1": 80,
      "last": 10,
      "new": 0
    },
    {
      "propA": 33,
      "propB": 90,
      "propC": 38,
      "last": 100,
      "new": 0
    }
  ]</code></p>
  
  <p>I tried to accomplish this by typing the following into vim: <code>q q /last ENTER $ a , ESC p q</code>. I had <code>"new: 0</code> copied to my clipboard. It appears that the search part isn't working because each time I run the macro, it pastes the line where the cursor started instead of on the line with the next instance of the string "last". </p>