aboutsummaryrefslogtreecommitdiff
path: root/vim/config/whitespace.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-10-28 21:56:40 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-10-28 21:56:40 +1300
commit46be8760df20d934b15616c0f97a7c5bb55c6227 (patch)
treede5c51116d3e127da656423b08689678a4f8c26e /vim/config/whitespace.vim
parentMove list .vimrc config into subfile (diff)
downloaddotfiles-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.vim14
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