пятница, 5 февраля 2010 г.

Remove trailing spaces with VIM

When trying to commit Git raised error:
* You have some suspicious patch lines:

The reason was - trailing spaces (spaces before end of line). VIM inserts spaces when auto formatting code. I found a Nice solution at vim.wikia.com. Insert into your .vimrc line:
autocmd BufWritePre * :%s/\s\+$//e

It will remove all trailing spaces after each file write to disk. Very useful.

Also you can disable this git warning by executing:

$ git config --global core.whitespace nowarn


Комментарии

технология комментирования HyperComments


2008–2014 © Сергей Удалов Реклама Система Orphus