11 votes
Accepted

How safe is it to use an unknown `_vimrc` or `vimscript` file?

Well, Vim can execute arbitrary commands with :!. It can set environment variables. Malware scripts that are shell scripts can, therefore, be run from Vimscript. It can make use of complex Perl, ...
muru's user avatar
  • 24.9k
11 votes

The simplest way to start Vim in private mode

Well, a bit belated but to respond to: Some magic (from a comment by Carpetsmoker in this thread) My general idea was that you always want to start "private mode" if you're using an ...
Martin Tournoij's user avatar
7 votes

How safe is it to use an unknown `_vimrc` or `vimscript` file?

Extending on muru's answer, you could inspect the code, specially as the plugin code is usually very short (the exceptions are some popular plugins, but by being popular they are safer -- you can ...
mMontu's user avatar
  • 6,640
3 votes

Is it safe to open encrypted/sensitive text files from a zip archive with vim/gvim?

No. You should disable swap file and unset viminfo. Also the memory contents is not encrypted. More info here.
Antonio's user avatar
  • 287
2 votes

The simplest way to start Vim in private mode

According to Vim documentation (:help -c) there can only be a maximum of 10 +{command}, -c {command} and -S {file} option arguments combined when starting Vim, and they execute _after_ the first file ...
mvanle's user avatar
  • 121
2 votes

How does vim decide if a file is "readonly"?

Based on a quick experiment: # touch readonly # chmod a-w readonly Now, vim readonly will start in readonly mode, because the current user does not have write permission. But, as root or as a ...
D. Ben Knoble's user avatar
  • 26.2k
1 vote

Is there a way to edit secure data in vim without accessing the filesystem?

Assuming you have commands decrypt and encrypt that use stdout and stdin: # open vim using stdin decrypt secret.msg | vim - Then after you edit the file in vim: :w !encrypt secret2.msg That is ...
wisbucky's user avatar
  • 950
1 vote

Is there a way to edit secure data in vim without accessing the filesystem?

There are some things hidden in the vim docs that can help you. read ! your shell command: read the output of "your shell command" into the current buffer (a tempfile is used to read the data!) let ...
Lucas's user avatar
  • 1,629
1 vote

How to create a new 'secure scratchpad' buffer?

In this case i would :new :setlocal buftype=nofile :setlocal bufhidden=hide :setlocal noswapfile buftype=nofile does not associate the buffer with a file. noswapfile does not create a swapfile. ...
mike's user avatar
  • 949
1 vote

How can I securely restrict vim access to a single file?

Have you looked at :h :sandbox? These items are not allowed in the sandbox: - changing the buffer text - defining or changing mapping, autocommands, functions, user commands - setting certain ...
Tommy A's user avatar
  • 6,770
1 vote

Is it safe to open encrypted/sensitive text files from a zip archive with vim/gvim?

As mentioned by Antonio, it's a good idea to disable the swap file and also prevent backups: :set noswapfile nobackup If you want to make sure that it does not stay in memory, just quit vim once you ...
Alexis Wilke's user avatar
1 vote

The simplest way to start Vim in private mode

A slightly neater looking alias: alias vimprivate='vim -u NONE -c "setlocal history=0 nobackup nomodeline noshelltemp noswapfile noundofile nowritebackup secure viminfo=\"\""'
Mateen Ulhaq's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible