-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
add --readonly flag to enter readonly mode #7128
Conversation
But it's not a readonly mode because I can still modify documents. Maybe would be better to forbid switching to insert mode or show error if user trying to? LSP also can modify documents. And there is the auto save option in the editor config. |
Just blocking insert mode wouldn't be enough, since there are several ways to change the buffer in normal mode (eg. paste or execute shell commands). In my experience, LSP's only modify on save, which is blocked with these changes already. I didn't check out the auto-save option, but I expect it to use the same
|
I definitely want a concept of read-only in Helix but it should be more extensive, and I think the design of the feature needs some discussion (i.e. an idea discussion). I'm hesitant about an editor-wide read-only mode and I'm fairly certain a Document should not be locked in a read-only state: it should be possible to write a read-only Document to a path which isn't read-only. Kakoune has a nice read-only feature including refusal to enter insert-mode that could be inspiration for this in Helix. |
+1. What is the current status of this PR? I'd really like having a readonly flag. Thanks! |
@3f6a On my part the current status is that I occasionally rebase this branch and use that (plus the patch from #8362) for my custom build. I'm happy with this minimal patch as-is and am not planning to lead the idea discussion or extend the code accordingly. I'm keeping this patch relatively up-to-date for my own workflows, and I'm sharing it with the community in case other people would like the same, but I don't expect this PR to be merged any time soon. |
Closing this one out as this feature needs design dicussion and major changes and will not be merged in this form (see @the-mikedavis comment above). Thank you for contributing |
I started #11586 to discuss. I'm interest in seeing this and even working on it. |
This is a very rough approach, but I was missing something like vim's
-R
where you can open a file without accidentally writing to itIt can probably be adapted to recognise no-write files (r-- or r-x) as well, as suggested in #2627
And it can probably also be adapted to enable readonly for specific buffers instead of editor-wide, as suggested in #3709