aboutsummaryrefslogtreecommitdiff
path: root/vim/config/whitespace.vim
blob: 103ef80850cd92a2994f4ae1393a2e57045e506f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
" 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
    let l:ll = line('$')
    while l:li <= l:ll
      let l:line = getline(l:li)
      call setline(l:li, substitute(l:line, '\m\C\s\+$', '', 'g'))
      let l:li = l:li + 1
    endwhile
  endfunction
  nnoremap <silent> <leader>x :<C-U>call <SID>StripTrailingWhitespace()<CR>
endif