From 92d08970c2e09c6799cf2c9a03f982a23c950a89 Mon Sep 17 00:00:00 2001 From: Cody Hiar Date: Tue, 9 Mar 2021 10:50:36 -0700 Subject: remove trailing space on save --- plugin/vim-options.vim | 2 ++ 1 file changed, 2 insertions(+) (limited to 'plugin') 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 -- cgit v1.2.3