diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-10-28 21:56:40 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-10-28 21:56:40 +1300 |
commit | 46be8760df20d934b15616c0f97a7c5bb55c6227 (patch) | |
tree | de5c51116d3e127da656423b08689678a4f8c26e /vim/config/whitespace.vim | |
parent | Move list .vimrc config into subfile (diff) | |
download | dotfiles-46be8760df20d934b15616c0f97a7c5bb55c6227.tar.gz dotfiles-46be8760df20d934b15616c0f97a7c5bb55c6227.zip |
Move whitespace .vimrc config into subfile
The StripTrailingWhitespace() function should perhaps be its own plugin.
Diffstat (limited to 'vim/config/whitespace.vim')
-rw-r--r-- | vim/config/whitespace.vim | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/vim/config/whitespace.vim b/vim/config/whitespace.vim new file mode 100644 index 00000000..2202f47b --- /dev/null +++ b/vim/config/whitespace.vim @@ -0,0 +1,14 @@ +" 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! StripTrailingWhitespace() + let l:search = @/ + %substitute/\s\+$//e + let @/ = l:search + nohlsearch + endfunction + nnoremap <silent> <leader>x :<C-U>call StripTrailingWhitespace()<CR> +endif |