stefandtw / quickfix-reflector.vim

Change code right in the quickfix window
MIT License
340 stars 19 forks source link

Write not working: no filename #28

Closed Mephistophiles closed 1 year ago

Mephistophiles commented 5 years ago

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
stefandtw commented 5 years ago

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.

obxhdx commented 4 years ago

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 commented 4 years ago

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.