Previewed files are readonly when opened
joeytwiddle opened this issue · comments
Steps to reproduce:
- Get a QuickFix window with a few files in it (e.g. using
:grep
) - Hit
<Enter>
on a file and notice that it opens with readonly unset. - But hit
p
one or more times on a file and then hit<Enter>
. That file will open withreadonly
set. - (You can test that with
:verb set readonly?
)
A) I suppose one solution would be:
- When we set the buffer values on a preview window, store the pre-existing values in some namespaced buffer variables.
- When we close that buffer, or open that buffer for editing, we can restore the original values from those variables.
B) Alternative solution: Completely :bwipeout
the buffer before opening it for editing. Then it should open with fresh settings.
(Of course we don't want to do that if the buffer was already open before we started previewing.)
I have already implemented solution B in my branch: matt1003/quickr-preview.vim@ed3b58d
I had issues with :bwipeout
, however :bdelete
seemed to do the trick. It has been working well for me for several months. @ronakg, would you like me to put together a pull request?
The fix is working for me, so closing. Many thanks!