diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2014-11-03 00:03:49 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2014-11-03 00:03:49 +1300 |
commit | d41ab635ac3c47999f309763f48e217db695e848 (patch) | |
tree | 205362dd138969fe613a0cd6e731cb0b170862a5 /vim/vimrc | |
parent | Make explicit local vars (diff) | |
download | dotfiles-d41ab635ac3c47999f309763f48e217db695e848.tar.gz dotfiles-d41ab635ac3c47999f309763f48e217db695e848.zip |
Make function of whitespace stripper
Diffstat (limited to 'vim/vimrc')
-rw-r--r-- | vim/vimrc | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -170,8 +170,15 @@ if has('eval') endif " Strip trailing whitespace with \x -nnoremap <silent> <leader>x - \ :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar>:nohl<CR> +if has('eval') + function! StripTrailingWhitespace() + let l:search = @/ + %s/\s\+$//e + let @/ = l:search + nohlsearch + endfunction + nnoremap <silent> <leader>x :<C-U>call StripTrailingWhitespace()<CR> +endif " Keep plenty of command and search history, because disk space is cheap set history=2000 |