ronakg / quickr-preview.vim

Quickly preview Quickfix results in vim without opening the file

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Previewed files are readonly when opened

joeytwiddle opened this issue · comments

Steps to reproduce:

  1. Get a QuickFix window with a few files in it (e.g. using :grep)
  2. Hit <Enter> on a file and notice that it opens with readonly unset.
  3. But hit p one or more times on a file and then hit <Enter>. That file will open with readonly set.
  4. (You can test that with :verb set readonly?)

A) I suppose one solution would be:

  1. When we set the buffer values on a preview window, store the pre-existing values in some namespaced buffer variables.
  2. 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!