vim: delete the first 2 spaces for multiple lines

前端 未结 7 1575
无人及你
无人及你 2020-12-22 18:36

What\'s the easiest way to delete the first 2 spaces for each line using VIM? Basically it\'s repeating \"2x\" for each line.

Clarification: here the assumption is t

7条回答
  •  半阙折子戏
    2020-12-22 19:21

    You could also use a search and replace (in the ex editor, accessed via the : character):

    Remove first two characters no matter what:

    %s/^.\{2}//
    

    Remove first two white space characters (must be at the beginning and both must be whitespace... any line not matching that criteria will be skipped):

    %s/^\s\{2}//
    

提交回复
热议问题