Frenetic Array

A canvas for logic and imagination.

Trailing Spacing

One of the most frustrating things to deal with is trailing whitespace. Trailing whitespace is such a pain because:

  • It can screw up string literals
  • It can break expectations in a text editor (i.e. jumping to a new line or the end of the line)
  • It can actually break programming languages
  • It is just unflattering

However, in Vim, it takes one autocmd to alleviate this.

augroup spaces  
    autocmd!
    autocmd BufWritePre * %s/\s\+$//e
augroup END  

On every buffer save substitute spaces at the end of the line with nothing. Easy!