Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Atomic write with Vim

Tags:

vim

Can I configure Vim so it does an atomic write?

The default Vim behavior is:

  • move file.txt to file.txt~
  • write buffer contents to file.txt

But this causes some problem with compass watch for example

I would like behavior like:

  • write buffer contents to file.txt~
  • move file.txt~ to file.txt

I've looked at the backup, backupcopy and writebackup options but I can't get Vim configured as I want.

like image 368
Leon Avatar asked Dec 08 '13 19:12

Leon


1 Answers

:set backupcopy=yes is probably what you want.

You could also use the `backupskip' option on the paths you are particularly worried about.

like image 55
Tom Whittock Avatar answered Nov 16 '22 19:11

Tom Whittock