aboutsummaryrefslogtreecommitdiff
path: root/vim/plugin
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-11-07 09:30:05 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-11-07 09:37:24 +1300
commitc0e1371d3bdb9749d39c63e86a3678eb434d4ccb (patch)
tree0920cdb2cd97b3e85f023eeec6520e2274f2cd26 /vim/plugin
parent05a5347ee0bcb634fe706c3f522769a35fe245fb (diff)
downloaddotfiles-c0e1371d3bdb9749d39c63e86a3678eb434d4ccb.tar.gz
dotfiles-c0e1371d3bdb9749d39c63e86a3678eb434d4ccb.zip
Add :StripTrailingWhitespace command
This is optional; if the user's Vim doesn't have the 'user_commands' feature, the command will just quietly not be created.
Diffstat (limited to 'vim/plugin')
-rw-r--r--vim/plugin/strip_trailing_whitespace.vim11
1 files changed, 9 insertions, 2 deletions
diff --git a/vim/plugin/strip_trailing_whitespace.vim b/vim/plugin/strip_trailing_whitespace.vim
index 9fb2e65b..1264a11f 100644
--- a/vim/plugin/strip_trailing_whitespace.vim
+++ b/vim/plugin/strip_trailing_whitespace.vim
@@ -1,6 +1,6 @@
"
-" strip_trailing_whitespace.vim: User-defined key mapping to strip trailing
-" whitespace in the whole document.
+" strip_trailing_whitespace.vim: User-defined key mapping and optional command
+" to strip trailing whitespace in the whole document.
"
" Author: Tom Ryder <tom@sanctum.geek.nz>
" License: Same as Vim itself
@@ -67,3 +67,10 @@ endfunction
noremap <silent> <unique>
\ <Plug>StripTrailingWhitespace
\ :<C-U>call <SID>StripTrailingWhitespace()<CR>
+
+" Define a user command too, if we can
+if has('user_commands')
+ command -nargs=0
+ \ StripTrailingWhiteSpace
+ \ call <SID>StripTrailingWhitespace()
+endif