martanne / vis

A vi-like editor based on Plan 9's structural regular expressions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request]: file locking, prevent double-editing

mralusw opened this issue · comments

What feature would you like to see?

Even nano has some mechanism to prevent editing the same file from two different processes. Combined with lack of window/tab support, and the suggestion to use the window manager for that (without client/server support), it's a double whammy.

I don't quite understand your complaint. vis allows you to edit the same file multiple times, yes. But if you want to save your changes, you get a warning that tells you that the file already exists, thus, not overwriting your previous changes. That's basically the behavior most editors (like vim or nano) have. They also don't protect the open file from being overwritten by a third-party process.

If I try to open the same file in two different vim instances, there will be a swapfile conflict and a warning (upon opening). nano has some similar mechanism.

It appears vis has some mechanism to keep track of... the previous version of the file when it was last saved? Or the previous date? Both? I'm not sure what it has, because with two running instances of vis and a touch command from a different shell I quickly got into a situation where neither vis instanced was willing to save without w!. Even with repeated w!.

Now, I wouldn't mind normally, but since there is no client / server mechanism, and since you advise using the window manager's features for tabs / panes, it seems like one can easily get into some nasty situations. It would be better to detect concurrent editing when opening a buffer, not when attempting to save.

I also would like that feature!, that *does not allow to open same file again with another instance. Is not enough to get a warning on saving, because I use vis everyday with tmux and sometimes happens to me, then get a warning, and is annoying, because I need 2 save with another name and then make a diff to update a file and delete the other one.

Maybe can be a enabled in visrc.lua, but I think should be default. I don't understand the reasoning to allow working 2 or more instances with the same user/machine.

I'm happy using tmux as "window manager" with tabs and panes, I don't understand why there are internal commands like: split, vsplit.

The alternative to me, If you have 2 or more instances with same file, every time there is a change, update in the other ones, to be in sync, maybe is more work to do this, also can be enabled in visrc.lua.

I did ticket #1141 on December, and was closed as "not planned", I hope now gets more attention.