From e00f5276dc6e7d9af446003e0dbfa1e8ccba3194 Mon Sep 17 00:00:00 2001 From: Tharre Date: Fri, 22 Sep 2017 05:43:08 +0200 Subject: vim: strip whitespaces with F5 instead of on save The code was taken from [0]. [0] https://vi.stackexchange.com/questions/454/ --- .vimrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.vimrc b/.vimrc index 535435f..21dd733 100644 --- a/.vimrc +++ b/.vimrc @@ -81,8 +81,8 @@ map Q @ map :tabprevious map m :tabnext -" remove trailing whitespaces on save -autocmd BufWritePre * :%s/\s\+$//e +" map F5 to removing trailing whitespace +nnoremap :let _s=@/:%s/\s\+$//e:let @/=_s " save file with root permissions cmap w!! w !sudo tee % >/dev/null -- cgit v1.2.3-70-g09d2