Wednesday, February 25, 2015

Re: Capturing setting ro/noro

On Wednesday, February 25, 2015 at 3:57:57 AM UTC-6, Axel Bender wrote:
> Is there a way to capture the setting of readonly? I.e. I'd like to be able to inject a function when the readonly setting is changed.

No, you cannot detect when arbitrary options change.

You could monitor for an option change in a CursorHold event, maybe even combined with CursorMoved, etc.

But readonly will only change automatically when reading the file. So is BufReadPost sufficient for your needs? Why do you need to detect when the value changed?

For all these methods, you can read the current value with something like:

:let current_readonly = &readonly

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: