aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Hiar <cody@hiar.ca>2021-03-09 10:50:36 -0700
committerCody Hiar <cody@hiar.ca>2021-03-09 10:50:51 -0700
commit92d08970c2e09c6799cf2c9a03f982a23c950a89 (patch)
treed217a7e0a46089dbf78c104d80f1ea2bb1072f84
parentf115d0b9fafc900e815cde91db4b8ba6103d9102 (diff)
remove trailing space on save
-rw-r--r--plugin/vim-options.vim2
1 files changed, 2 insertions, 0 deletions
diff --git a/plugin/vim-options.vim b/plugin/vim-options.vim
index 7260497..f9a87e0 100644
--- a/plugin/vim-options.vim
+++ b/plugin/vim-options.vim
@@ -55,6 +55,8 @@ highlight ColorColumn ctermbg=cyan
au BufEnter *.py let w:m1=matchadd('ColorColumn', '\%81v', 100)
au BufEnter *.py let w:m2=matchadd('Error', '\%121v', 100)
au BufLeave *.py call clearmatches()
+" Remove trailing space on save but use sed to maintain cursor position
+autocmd BufWritePre * :%!sed -r 's/\s+$//'
" Neovim (Docker) vs Vim