Language:
Vim/Vim script     Change language:
Pastebin: 132583
Author: Anonymous
Subject: Untitled
Created: 2010-02-06 17:34:10
Download and save
Toggle line numbers
1function! remove_whitespace() 
2    if &bin | return | endif 
3    if search('\s\+$', 'n') 
4        let line = line('.') | let col = col('.') 
5        sil %s/\s\+$//ge 
6        call cursor(line, col) 
7        echo 'removed trailing whitespace' 
8    else 
9        echo 'no trailing whitespace found' 
10    endif 
11endf 
12nnoremap <F11> :call remove_whitespace()<CR> 
13 
14if has("autocmd") 
15    augroup vimrcEx 
16    autocmd
17    autocmd BufWritePost :call remove_whitespace()<CR> 
18    augroup END 
19endif 
Thread:
[132583] Untitled by Anonymous at 2010-02-06 17:34:10
  [132585] Re: Untitled by Anonymous at 2010-02-06 17:55:26 (diff)
Tip: Click the line numbers to toggle highliting on that line.

Paste followup:

Language:
Author:
Subject:


    Tabstop:     bigger biggest
Note: You can prefix a line with "@@@" to highlight it.