From 8f1fa83c6d86763df3873097777cebcead65a206 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Wed, 19 Dec 2012 00:04:00 -0600 Subject: [PATCH] Auto strip trailing whitespace in Python modules --HG-- extra : amend_source : 5e2c413a7e9ce3c04bb86abf5254631db449d443 --- ftplugin/python.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ftplugin/python.vim b/ftplugin/python.vim index e02b570..d7d03aa 100644 --- a/ftplugin/python.vim +++ b/ftplugin/python.vim @@ -5,3 +5,8 @@ setlocal expandtab setlocal autoindent setlocal smartindent setlocal cinwords=if,elif,else,for,while,try,except,finally,def,class +if !exists("stripwhitespace_autocommand") + let stripwhitespace_autocommand = 1 + aug stripwhitespace + autocmd stripwhitespace BufWritePre %s/\s\+$//e +endif