:%s/^123$/This garbled code.\r&/g
"&" 代表匹配到的字符串.在不知道 "123" 这个确切字符串时无需再打一边,只要写得出 pattern 就可以.
请看手册: Search and replace
When replacing:
\r is newline,
\n is a null byte (0x00).
\& is ampersand (& is the text that matches the search pattern).
\0 inserts the text matched by the entire pattern
\1 inserts the text of the first backreference.
\2 inserts the second backreference, and so on.
2木成林 问得 Block 前后插入, vim 里没有试验过,不过好像 sed 应该更适合作这个...