Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to start vim in "private mode"

Tags:

vim

privacy

Modern browsers have a feature called "private mode" or "incognito mode". I am trying to do the same thing with vim, i.e. run it in way that no traces of my activities are left behind. This way I would be able to e.g. use vim to open a file containing sensitive information stored in an encrypted volume without having to worry that any information will be leaked.

Here's what I have done so far:

alias vim_private="vim -i NONE --cmd 'set noswapfile' --cmd 'set nobackup'"

I have that in my .bashrc. Rationale for the above:

  • -i NONE so that no filenames or register contents are leaked through .viminfo
  • --cmd 'set noswapfile' is to prevent the creation a swap file
  • --cmd 'set nobackup' for no backup files

Is there is anything else that I'm missing? Are there any other ways that vim could leak information?

like image 598
safsaf32 Avatar asked Apr 09 '13 07:04

safsaf32


1 Answers

Your settings look fine. I'm not sure whether plugins will be loaded when you invoke Vim as vi, but several plugins (that e.g. provide MRU functionality) will store information (usually in ~/.vim... files), too. Their load can be avoided through --noplugin.

Also, for the paranoid, $VIMINIT, :set exrc, and :set modeline can lead to Vimscript code being executed; this could (re-)enable privacy-relevant options.

like image 82
Ingo Karkat Avatar answered Oct 03 '22 02:10

Ingo Karkat