quickfix-reflector.vim icon indicating copy to clipboard operation
quickfix-reflector.vim copied to clipboard

Write not working: no filename

Open Mephistophiles opened this issue 4 years ago • 3 comments

I try this plugin from neovim/vim

for me works this fix:

diff --git a/plugin/quickfix-reflector.vim b/plugin/quickfix-reflector.vim
index dbad617..3342f3d 100644
--- a/plugin/quickfix-reflector.vim
+++ b/plugin/quickfix-reflector.vim
@@ -34,7 +34,7 @@ function! s:OnQuickfixInit()
 	augroup END
 	" Set a file name for the buffer. This makes it possible to write the
 	" buffer using :w, :x and other built-in commands.
-	execute 'write! quickfix-' .  bufnr('%')
+	execute 'saveas! quickfix-' .  bufnr('%')
 	call s:PrepareBuffer()
 endfunction
 

Mephistophiles avatar Aug 12 '19 07:08 Mephistophiles

Hello!

When I wrote the plug-in, I tried a few different ways to set the file name. If I remember right, write! worked best. Some other commands sometimes accidentally saved the quickfix list to a file instead of just setting the file name. So I would prefer not to make this change (unless it was 100% clear that it's an improvement).

Any idea why write doesn't work for you? Perhaps :messages has some output.

stefandtw avatar Aug 12 '19 21:08 stefandtw

Same thing here. I'm using NVIM v0.4.3 and the substitution is only propagated back to their respective files if I make the change suggested by @Mephistophiles.

One problem though is that with this change, every time the quickfix opens, a new empty buffer also gets created. So eventually you will get a pile unwanted empty buffers.

obxhdx avatar Jul 31 '20 20:07 obxhdx

That's strange. I was playing with the code to understand this better but now it works fine with no modifications. Something seems to be causing this intermittent behavior.

obxhdx avatar Jul 31 '20 20:07 obxhdx