Creating signatures of a class in vim -
i have file filled text:
class baz { void test() { } int sum (int) { } }
and want create buffer text following:
interface ibaz { void test(); int sum (int); }
how can edit in vim. plugin or strokes on keyboard
if file follows exact pattern posted, can solve 4 commands:
:%s/^class\s*/interface :%s/^\s\+{\_[^}]*}// :g/^\s*$/d :%s/)\zs$/;
- change
class
interface i
- delete indented blocks
- remove blank lines
- add
;
after ending)
if need use in more 1 file (though recommend if you're going use once) copy , paste text buffer write on file, /tmp/cs
. then, while focused on buffer want change, run :so /tmp/cs
.
Comments
Post a Comment