vim-gnupg icon indicating copy to clipboard operation
vim-gnupg copied to clipboard

Lack of locking

Open cdown opened this issue 5 years ago • 2 comments

Usually in vim, one can't open the same file twice because a swap file is present, and one gets a warning on the second open (ie. the "Another program may be editing the same file" warning). This is not foolproof, but it generally works.

However, this doesn't happen when editing files with vim-gnupg -- it's possible to open the same file multiple times. Makes sense, since the normal version is implemented using swap files, but perhaps there should be some other form of synchronisation.

Not a massive deal for my use case, since I can just add flocking externally, but I'm not sure if this is intentional or an oversight :-)

cdown avatar Mar 20 '19 11:03 cdown

Not a massive deal for my use case, since I can just add flocking externally, but I'm not sure if this is intentional or an oversight :-)

It's a side effect of disabling swap files. An interesting possibility might be to use a new buffer for the unencrypted contents and maintain the swapfile on the encrypted buffer.

I'm not sure how feasible that would be nor how much work it would take.

jamessan avatar Mar 27 '19 00:03 jamessan

I have been bitten by this as well.

It seems like what's wanted here is for vim to support locking-without-swapfile, or perhaps, swapfile-without-contents.

That smells like a job for a new/distinct vim plugin, which vim-gnupg could then make use of. I'm kind of surprised that doesn't exist already, but I couldn't find such a thing. There is some discussion of adding flock-style locking to vim, which might or might not be viable here...

hlein avatar Oct 24 '19 00:10 hlein