Ubuntu delete whitespace using vim

15.49 Muhamad Akbar Bin Widayat 0 Comments

MacVim icon, glossy style
MacVim icon, glossy style (Photo credit: Wikipedia)


Well, I share to you to delete white space using vim. Please follow me.
1. Copy function below to ~/.vimrc

function! DelWhiteSpace()
  %s/\s\+$//e
endfunction
autocmd BufWritePre     *.rb :call DelWhiteSpace()

2. Open a file that has whitespace and write
:call DelWhiteSpace()
3. And write to save and quit
:wq


Hopefully this article is useful. :)


Enhanced by Zemanta

0 komentar:

terimakasih komentarnya