Skip to content

Commit 6aea8b0

Browse files
TheResplandoraxelf4
authored andcommitted
Fix re-sourcing script throwing error
Adds a load-guard to prevent the plugin from being loaded more than once. This would happen for example when using vim-plug and running `:PlugUpdate`.
1 parent 101c8f2 commit 6aea8b0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

plugin/strip_trailing_whitespace.vim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
" Vim plugin that removes trailing whitespace from modified lines on save
22
let s:save_cpo = &cpo | set cpo&vim
33

4+
" Only load the plugin once
5+
if exists('g:loaded_strip_trailing_whitespace')
6+
finish
7+
endif
8+
let g:loaded_strip_trailing_whitespace = 1
9+
410
" Strip trailing whitespace
511
command -bar -range=% StripTrailingWhitespace keeppatterns <line1>,<line2>substitute/\s\+$//e
612

0 commit comments

Comments
 (0)