vim - Apply a set of lines to a template -
i want process set of lines , apply template each line. let's have following block of lines:
case esac if fi
and following output:
<yyinitial> {case} { return new symbol(sym.case); } ... <yyinitial> {fi} { return new symbol(sym.fi); }
so, thought of having template body apply each line, this:
<yyinitial> {###place_holder###} { return new symbol(sym.###place_holder###); }
and apply each line.
what thought of selecting lines, putting in register ("a, instance), selecting template putting in register ("b) , call external script generates output. no luck (don't know how pass contents of register external script).
any other approach welcome.
this command job:
:%s/.*/<yyinitial> {&} {\r\treturn new symbol(sym.&);\r}/
you remove %
, if visual selected lines. create mapping or user command it, if used often.
Comments
Post a Comment