How to edit blocks in vim without visual block mode

前端 未结 3 1430
忘掉有多难
忘掉有多难 2021-01-26 04:53

Is there a way to edit a vertical block in a code without using the visual block mode selection?

3条回答
  •  执念已碎
    2021-01-26 05:44

    You can do something similar to this recent answer: https://stackoverflow.com/a/22238813/3130080

    For example,

    :%s/\%6c/x/
    

    will insert "x" before the 6'th character in each line, and

    :1,2s/\%>1c\%<4c.//g
    

    will delete characters 2 and 3 in lines 1 and 2.

    :help /\%c
    

提交回复
热议问题