3 ms·
For me the most important thing was learning to add a 'j' at the end of each macro and running it multiple times. So lets say you want to crack open an array th
by alinajaf 16y ago
For me the most important thing was learning to add a 'j' at the end of each macro and running it multiple times. So lets say you want to crack open an array that looks like this:
$address = array(
'name' => '',
'line1' => '',
'line2' => '',
'state' => '',
'country' => '',
'postcode' => '',
);
That's a lot of commas and quotes etc. Nowadays I usually punch this into vim:
name
line1
line2
state
country
postcode
Then I start on the first line and record a macro that wraps that word in quotes, then appends hashrocket, quotes, comma, and then moves to the next line. Run the macro 5 times with 5@<register> and the you get your array.
- burgerbrain 16y agoIf you're a heavy macro user, you might find `:noremap <Space> @q` to be handy. Just stick your temporary macro in q (the easiest one to stick it in :), then press the spacebar to run it whenever you want.