3 ms·
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> ' typ
by weaksauce 14y ago
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)