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!