3

I am trying to automate running any Python file in a directory when the file is saved. That way, the doctests will run, and I don't have to switch away from the editor.

My problem is that whenever I save a .py file, it runs twice.

Here's my command:

ls *.py | entr -p python /_

The -p is to postpone until the file is saved, and that works fine.

hstr
  • 193

1 Answers1

3

The issue stems from how vim writes files in two stages by default. When inotify (which entr is based on) sees these events they're interpreted as two saves.

On my machine, this fixes the issue:

:set backupcopy=yes

You can add that to your .vimrc to make it permanent.

spro
  • 146