The only way I can think to do this involves an sudo, which I don't know if you are in favor or familiar with. Here's my thought:
[list=1][*]Add all members of both groups to a new (third) group[*]Set the group for this directory to this new group (chgrp newGroup /some/dir)[*]Set the permissions to 750 for the directory[*]Set up an SUDO for the members of g1 to use to be able to write to the directory as the owner of the directory
Add something like this with visudo
%g1 ALL=(ownerOfDir) NOPASSWD: ALIASEDVI
You may want to set up an alias for the members of g1 to use so they won't have to type in a long command to be able to modify a file in that directory.
alias visharedfile='sudo -u USERTORUNASFROMSUDO /path/to/vi'[/list=1]
A thought, not necessarily the best one.