How to empty out a column
I'm searching to empty out multiple columns in VIM
(not to delete but to put spaces inside).This is my search command:
/\%2c\|\%4c\|\%>5c\%<9c
(column: 2,4,6-8)
How can I empty o开发者_如何学JAVAut these columns in vim?
:%s/\%2c\|\%4c\|\%>5c\%<9c/ /g
doesn't work/\%c
is a zero-width match.
You'll need to match something like:
/\v^(.).(.).(.)...
Which will keep the values of columns 1, 3, and 5 in groups.
Then you can substitute:
:%s!\v^(.).(.).(.)...!\1 \2 \3 !
...keeping columns 1, 3, and 5 but replacing the rest of the first eight columns with spaces.
精彩评论