aboutsummaryrefslogtreecommitdiff
path: root/vim/config/whitespace.vim
blob: 4189d858491bd6397b0ed0863c678cc228e72e77 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
" Don't join lines with two spaces at the end of sentences; I don't two-space,
" despite the noble Steve Losh's exhortations
set nojoinspaces

" Strip trailing whitespace with \x
if has('eval')
  function! s:StripTrailingWhitespace()
    let l:li = 1
    for l:line in getline(1,'$')
      call setline(l:li, substitute(l:line, '\m\C\s\+$', '', 'g'))
      let l:li = l:li + 1
    endfor
  endfunction
  nnoremap <silent> <leader>x :<C-U>call <SID>StripTrailingWhitespace()<CR>
endif