Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to temporarily store and manipulate sensitive data in vim. I know it keeps cut and copy registers and swap files on the hard drive, though. If you think about this for a moment, you'll see my concern. I would like to open a vim session in which none of the data I enter or manipulate gets written to the hard drive. I have heard of PGP plugins for vim, in which you can write e-mail securely, encrypt it for certain recipients, save it, then encrypt it. Such a plugin must have already solved this problem. But I don't need any of the encryption features. I just need the "secretive" mode.

What will I have to do to accomplish this?

share|improve this question
Besides from the answers below: When you're working with secret data more often, you'd want an encrypted swap anyway, too. – ott-- May 11 '13 at 21:44
up vote 2 down vote accepted

If you want to be sure, you can always run it in chroot environment on temporary tmpfs filesystem.

share|improve this answer
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. – Simon May 11 '13 at 21:13
@Simon, I do not agree. It is an answer indeed. If you run vim in chroot on tmpfs then problem is solved. vim has no way of writing anything to disk. – Michał Šrajer May 11 '13 at 21:19
Then more information on it in the answer would be good. – AthomSfere May 11 '13 at 22:00
@Simon, I agree with @Michał –– this is a very good answer. I also happen to believe that it’s at an adequate level of detail. If you need more information, just look up chroot and tmpfs in the manual or a search engine. – Scott May 11 '13 at 22:43
Note that vim running in a chroot environment will have no way of accessing the secure documents, unless they're copied into that environment. (Your .vimrc and other vim configuration data would have to be copied in there as well) – Trevor Powell May 13 '13 at 23:18

To achieve a limited feeling of security, you could put the lines below in ~/.discreetrc:

set noswapfile
set nobackup
set history=0
set viminfo=
set clipboard=

and launch Vim with:

$ vim -u ~/.discreetrc --noplugin secretfilename

but there are probably other useful options.

share|improve this answer

How about mapping the write command to something that doesn't write to the disk, e.g.,

:cmap w echo 'disabled!'
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .