Unable to match one or more whitespaces in Vim

前端 未结 9 699
一个人的身影
一个人的身影 2020-12-28 11:55

I want match spaces at the beginning of lines in Vim

PseudoCode of what I want to do

^( )*

I know the following fr

9条回答
  •  遥遥无期
    2020-12-28 12:25

    I think you can really do is match spaces until some kind of non-space character, right? Try this:

    ^\( \+\)

    Or, for any kind of whitespace:

    ^\(\s\+\)

    In Vim regex (, ) and + need to be escaped. Also, if you planning to use backreference, the syntax is \1 (the first group, for example) and not $1 like Perl.

提交回复
热议问题