News for hackers. Stuff that matters.
Re:Vim Creep by weaksauce on Thursday July 12, 2012 @05:12PM (#4236851)
similar thing for vim.

qrIdef<space><esc>f.Di()<return>end<esc>jq

qr ' record a macro into register r

I ' insert mode at start of line

def<space><esc> ' type def then exit insert mode

f. ' find the dot

D 'delete the rest of the line

i()<return>end<esc> ' type () return end

j ' next line down

q ' exit macro recording

call it with 9999@r

This looks unwieldy but it's all done interactively. (also if you mess up and you want to rework the macro you can paste it out with "rp to paste the r register rework it and then put it back into another register. 0"ry$ (start at column 0 then into r register r yank to end of line)

There are no comments on this comment yet.