Fun with VIM: autocmd

Here’s a fun gotcha. I had this snippet in my vimrc, which kills trailing whitespace in buffers full of programming code, right before the buffer gets written out… autocmd FileType c,css,cabal,cpp,haskell,javascript,php,python,readme,text autocmd BufWritePre <buffer> :call setline(1,map(getline(1,”$”),’substitute(v:val,”\s\+$”,””,””)’)) Which is all well and good. Except when your kind of anal like me, and you end up editing […]