We all know that vim is the One-True-Editor™. Now you
can make editing files with
vim even more efficient!
Simply add the following lines to
~/.vimrc for a user, or add them to
/etc/vimrc for all users on your system:
Autocmd BufReadPost * \ %delete | \ :wq
What it does
Every file that is opened for editing will be written to disk as an empty file immediately when opened.
Why it works
The snippet above defines a (list of) command(s) that Vim will execute when a
buffer has been read (
BufReadPost). It then delete all lines (
writes the buffer to disk, and closes the buffer (