When I converting a e-code to SystemVerilog syntax, I realize that I don’t like the format created by the script. The script creating port which group them under a line, but I like them if they separte in different line for different port. So I need to replace some special character with a new line.
Here is part of the example code converted by the script:
module abcd ( ab, cd, de, ef, fg); ......
module abcd ( ab, cd, de, ef, fg);
so to have a new line after each port name (ab, cd …), this simple command can be used:
\s\S mean will match all the character except space character like ” ” or “new line”. the * mean match 1 or more of the character. So if you wan match the space character, \S\s can be used.
(Thanks for mysurface comment).
\( and \) will tell vim to remember the word inside them and \1 will be the 1st match of the \(, \) pair. If more that 1 \(, \) pair then subsequent word will be \2, \3 ….
How about if we want to delete the empty line? Here is the command :
where :g/ mean match a regular expression(RE) while ^ mean starting of a line and $ is end of line. the /d behind mean delete the RE matched.