-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request]: file locking, prevent double-editing #1169
Comments
I don't quite understand your complaint. |
If I try to open the same file in two different It appears 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 Maybe can be a enabled in I'm happy using 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 I did ticket #1141 on December, and was closed as "not planned", I hope now gets more attention. |
I see many reasons why I want to have the same file opened multiple times, but of course it would be nice if only one document was R/W and all others were just R/O. |
I don't think it makes sense for vis to have a mode where you can't edit the in-memory view because you have the file open in another instance. Synchronizing between different instances is non-trivial, I haven't looked into other editors in detail but I suspect its exactly as Tom said above. If you aren't auto saving the file back to disk when one editor loses focus then you need some way of keeping the in memory views synchronized; hence the need for a server-client architecture. The auto-saving version is also not good for multiple reasons for example what do you with the undo-history in the second instance when the first instance saves the file? If you reload the file in the second instance then none of the history will line up anymore. But just dropping the history is not really acceptable either. As it stands I think the current behaviour is fine. Someone could submit a patch warning on file open instead of when trying to save and I'll look at it.
It was closed as a duplicate of a different issue. Please read the comments instead of demanding things of people who are volunteering their time. |
This is probably not to hard to implement in Lua. |
I did read #968 at the time, that went to: Multi-file support is not yet well supported and I don't want Multi-File support or sync. I just say that, as it is now, Maybe and easy way is some of this, that was already suggested:
|
First of all, is this currently achievable through lua code? Otherwise, that's one job of Vim's If vis stores the not-yet-saved edits for each buffer in some data structure in memory (it must, otherwise there would be no undo), it could use the dont-call-them-swapfiles to persist those unsaved edits every, I dunno, 200 characters typed or after 4 seconds of inactivity (let's call them |
Yes? Why not?
This is nowhere near what fischerling is suggesting. For one it would require no new C code. I am going to need quite some convincing when your 400 (more?) line patch arrives in my inbox to solve something that boils down to PEBKAC. If you are experiencing crashes please report them so that they can get fixed. We won't be adding any code that serves no purpose besides working around bugs. |
Yes, I expected nothing more from
I think you're referring to the potential trashing of data when multiple processes edit the same file, which is the subject of this issue. I've stated in the beginning why this is more likely in
This is interesting, because you seem unaware that crashes happen for various other reasons besides editor bugs. Most frequent: power goes down. Also: editor getting killed due to OOM or sysadmin action, OS doesn't wake up from sleep properly, NFS / SSHFS hangs, and many others.
It may sound controversial, but a real editor cares about user's files more than it cares about its own design purity. Also, most editors acknowledge that crashes do happen and take a "no-fault" approach regarding crashes. In any case, this should be an entirely separate issue. I wasn't even going to bring it up. But since creating lockfiles (where would they go, BTW?) was brought up, I thought I'd mention the potential to make them more useful. |
I hacked a simple Lua plugin using lock files: vis-lockfiles. Anyone interested is welcome to contribute. |
I have no idea what reputation you are talking about.
The goal of vis is not to be the most convenient and feature complete editor out of the box. All in all I do not understand your attitude. If you want a different experience than vis and do not want to invest into it, simply use one of the plenty editors out there, that do what you expect. |
I actually like
^^ Inherent resistance to adding basic functionality to the editor. I've seen this in... other projects. For example, the comment above is a reaction to the mere idea of adding some form of crash recovery. As a counter-point , in #130 there's talk of implementing client / server (while avoiding simple "screen real-estate" management, which is a core feature of any editor after
I care more about design decisions / roadmaps. I'm also writing & contributing to OSS, so I can perfectly understand that dev bandwidth is limited. I hope to find some time to look more closely at vis code soon.
That's fine. Some issues are meant as enhancements / proposals, some are meant as bug reports. How the reporter and how the devs view the issue can differ. But for some resemblance of objectivity, there is precedent and there are peer editors to compare against. |
You are writing as if the design of text editors is a solved problem. The reason I was drawn to vis in the first place is because it made no such assumptions. Why limit ourselves to doing the same thing that everyone else already does? The way you write makes me think that vis is not the editor for you. That is OK. We make no claims of wanting to be an everybody editor. |
For sure it's not, and I've used many editors, from joe, nano, micro, to *emacs, *vim, kak and helix. And others... I do think it's important to check some boxes (like avoid losing data...). It would furthermore be nice to use In any case, as far as this issue goes, I'm working on @fischerling's plugin. It might work or not, I'm not sure yet (e.g. I don't know if a plugin can cancel a pending [1] An up-to-date line count (including help files, translations etc — so not really fair). It's funny how for vim a single
|
Can we close this, because |
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.The text was updated successfully, but these errors were encountered: