In general, you can't. You'll have to do something cooperative, like have every program agree to use a lock file.
It might be sufficient just to wrap accesses to the file with something like this:
# file: vilock perl -MFile::NFSLock -e ' $fname = shift; $lock = File::NFSLock->new($fname,"BLOCKING") or die $!; system $ENV{EDITOR}, $fname ' your-important-file
|
|---|