How can you automatically remove trailing whitespace in vim

后端 未结 13 2131
星月不相逢
星月不相逢 2020-12-02 03:39

I am getting \'trailing whitespace\' errors trying to commit some files in git.

I want to remove these trailing whitespace characters automatically right before I sa

13条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-02 04:06

    I also usually have a :

    match Todo /\s\+$/
    

    in my .vimrc file, so that end of line whitespace are hilighted.

    Todo being a syntax hilighting group-name that is used for hilighting keywords like TODO, FIXME or XXX. It has an annoyingly ugly yellowish background color, and I find it's the best to hilight things you don't want in your code :-)

提交回复
热议问题