How can you automatically remove trailing whitespace in vim

后端 未结 13 2130
星月不相逢
星月不相逢 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:07

    I found the answer here.

    Adding the following to my .vimrc file did the trick.

    autocmd BufWritePre *.py :%s/\s\+$//e
    

提交回复
热议问题