Skip to content

Commit

Permalink
Fixed trailing whitespace behavior.
Browse files Browse the repository at this point in the history
  • Loading branch information
zsiciarz committed Feb 16, 2012
1 parent e9f4a80 commit 758a589
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions vimrc
Expand Up @@ -31,8 +31,15 @@ set numberwidth=5
set ruler
set autochdir

" delete trailing whitespace in Python files
autocmd BufWritePre *.py normal m`:%s/\s\+$//e ``
" highlight trailing whitespace
highlight ExtraWhitespace ctermbg=red guibg=red
autocmd ColorScheme * highlight ExtraWhitespace guibg=red
autocmd BufEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhiteSpace /\s\+$/

" delete trailing whitespace
autocmd BufWritePre * :%s/\s\+$//e

nmap <C-s> :w<CR>
imap <C-s> <Esc>:w<CR>a
Expand Down

0 comments on commit 758a589

Please sign in to comment.