summaryrefslogtreecommitdiffstats
path: root/.vimrc
diff options
context:
space:
mode:
authorTharre <tharre3@gmail.com>2017-09-22 05:43:08 +0200
committerTharre <tharre3@gmail.com>2017-09-22 05:43:08 +0200
commite00f5276dc6e7d9af446003e0dbfa1e8ccba3194 (patch)
tree011d5e82aedee45f5b782dc0a3ea573b64917e0e /.vimrc
parent9e49c4b66f5151014dc5e95f5f1fcb33af987d41 (diff)
downloaddotfiles-e00f5276dc6e7d9af446003e0dbfa1e8ccba3194.tar.gz
dotfiles-e00f5276dc6e7d9af446003e0dbfa1e8ccba3194.tar.xz
dotfiles-e00f5276dc6e7d9af446003e0dbfa1e8ccba3194.zip
vim: strip whitespaces with F5 instead of on save
The code was taken from [0]. [0] https://vi.stackexchange.com/questions/454/
Diffstat (limited to '.vimrc')
-rw-r--r--.vimrc4
1 files 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 <S-m> :tabprevious<CR>
map m :tabnext<CR>
-" remove trailing whitespaces on save
-autocmd BufWritePre * :%s/\s\+$//e
+" map F5 to removing trailing whitespace
+nnoremap <F5> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar><CR>
" save file with root permissions
cmap w!! w !sudo tee % >/dev/null