Open mmahmoudian opened 4 months ago
You can use my lua code from https://github.com/zyedidia/micro/issues/2086#issuecomment-826351299 which adds toggle
and togglelocal
commands for toggling on/off arbitrary boolean options, and then you can bind your key to command:togglelocal readonly
.
set readonly
on orsetlocal readonly
on (the latter behaves very weirdly as the[ro]
does not show up in the status bar of that buffer. Should I open bug report or is it intended?).
You probably meant the former behaves very weirdly? setlocal readonly
is working as expected for me, but Sorry, ignore this info. This behavior was caused by my own lua stuff. Without that stuff, I see no issues: both set readonly
, which sets readonly
globally for all buffers, indeed does not add [ro]
to status bars of all those buffers. What's worse, it makes the command bar buffer readonly as well, so we are not able to type commands anymore. Seems worth fixing (although setting readonly
globally is probably not very useful anyway).setlocal readonly
and set readonly
behave as expected and [ro]
does show up.
Description of the problem or steps to reproduce
At the moment readonly can be done via either of
set readonly on
orsetlocal readonly on
(the latter behaves very weirdly as the[ro]
does not show up in the status bar of that buffer. Should I open bug report or is it intended?).I propose a command to toggle readonly mode for the current buffer. This is extra handy when browsing through a file and we want to protect it from modification, while keep editing in other buffers.
Specifications
I think micro needs yet another
Toggle*
command (i.eToggleReadonly
) which can be bound to keys. when triggered, toggles the readonly state of the current buffer.Version: 2.0.13 Commit hash: 68d88b57 Compiled on October 22, 2023 OS: Manjaro Terminal: Alacritty, Konsole, yakuake