From 5b1d4720979a4c62c6104aaa2fd9c0d3841f8a8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wo=C5=BAniak?= Date: Sun, 30 Aug 2020 15:13:25 +0200 Subject: [PATCH] Updated fix --- .vimrc | 6 +++++- .vimrc-gentoo | 9 ++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.vimrc b/.vimrc index 1f3da5b..5b9e048 100644 --- a/.vimrc +++ b/.vimrc @@ -13,7 +13,7 @@ au BufWritePre * let &bex = '@' . strftime("%F.%H:%M") " plugins call plug#begin('~/.vim/plugged') -Plug 'scrooloose/nerdtree', "{ 'on': 'NERDTreeToggle' } +Plug 'preservim/nerdtree', "{ 'on': 'NERDTreeToggle' } call plug#end() " Status-line @@ -83,3 +83,7 @@ nnoremap :tabprevious nnoremap :tabnext cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' edit! + +" Automatically deletes all trailing whitespace and newlines at end of file on save. +autocmd BufWritePre * %s/\s\+$//e +autocmd BufWritepre * %s/\n\+\%$//e diff --git a/.vimrc-gentoo b/.vimrc-gentoo index b90a0c6..95029e4 100644 --- a/.vimrc-gentoo +++ b/.vimrc-gentoo @@ -13,7 +13,7 @@ au BufWritePre * let &bex = '@' . strftime("%F.%H:%M") " plugins call plug#begin('~/.vim/plugged') -Plug 'scrooloose/nerdtree' +Plug 'preservim/nerdtree' Plug 'vimwiki/vimwiki' Plug 'nmante/vim-latex-live-preview' Plug 'lervag/vimtex' @@ -128,8 +128,11 @@ autocmd BufRead,BufNewFile /tmp/neomutt* :Goyo | set bg=light autocmd BufRead,BufNewFile /tmp/neomutt* map ZZ :Goyo\|x! autocmd BufRead,BufNewFile /tmp/neomutt* map ZQ :Goyo\|q! +" Automatically deletes all trailing whitespace and newlines at end of file on save. +autocmd BufWritePre * %s/\s\+$//e +autocmd BufWritepre * %s/\n\+\%$//e + " Auto add notes git -au BufNewFile,BufFilePre,BufRead *.md set filetype=markdown -"autocmd BufWritePost *.md :Prettier +autocmd BufWritePost *.md :Prettier "autocmd BufWritePost *.md execute '!git add % && git commit -m "Auto-commit: saved %" && git push' | redraw!