Tuesday March 31, 2009 Stopping vim from encrypting your files
I usually use :x to exit and save in vi and vim; there's no great reason for it, it just happens to be what I started using. The problem comes when I don't release the shift key fast enough, and end up typing :X instead, which offers to encrypt my file for me, and prompts for a key. It's only happened twice in my career, but twice too many, that I am typing ahead past the :X, enter a key I have no idea what it might be, and manage to be confused enough to save the file anyway...encrypted...with an unknown key.
Now of course I always have current backups, even of the changes I just made with the editor. Not.
In vi, I disabled this whenever I could by deleting the /usr/bin/crypt command (which I didn't need for anything else, as far as I could tell). However, vim has its own builtin cryptographic functions, so another method was necessary:
in my .vimrc, I put
:cmap X echo "no I won't encrypt, it just makes trouble"<CR>
presto, no more :X, and a handy message as to why. ( Mar 31 2009, 12:35:34 AM PDT ) Permalink Comments [1]