stefandtw / quickfix-reflector.vim

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

Always get [ERROR] for all changes #2

Closed idbrii closed 10 years ago

idbrii commented 10 years ago

I'm not having any luck making modifications from my quickfix. I tried loading gvim without any of my plugins, loading quickfix-reflector, and editing my quickfix, but still no luck:

$ gvim -u NONE -N
:source ~/.vim/bundle/quickfix-reflector/plugin/quickfix-reflector.vim
:h quickfix
:save /temp/qf.txt
:q
:e /temp/qf.txt
:vimgrep /This/ %
:copen
:%s/This/That/g
:w

I get 0/32 replacements.

I am using a slightly old version of vim:

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Oct 27 2010 17:59:02)
MS-Windows 32-bit GUI version with OLE support
Included patches: 1-46

I'm on Windows 7. I also tried forcing the file to use unix line endings with set ff=unix and dos2unix, but that doesn't fix it either. Any ideas?

stefandtw commented 10 years ago

Thanks for reporting!

Trying these steps, I noticed that the plug-in did not work correctly when starting Vim with -u NONE. This should be fixed now.

Also, save /temp/qf.txt is problematic. save will use the original buffer of the help file for your newly saved file. Replacements with quickfix-reflector.vim are done using Vim buffers internally. And since buffers of help files are read-only, doing the replacements will not work.

Try write /temp/qf.txt instead of save.

Not sure if this was even the original problem you were having. Are you getting any error messages? Maybe check using the :messages command.

idbrii commented 10 years ago

I also had the same problem with other files. quickfix.txt was an easy way to provide you a test case, but you're right I need to handle the buffer settings.

On another machine, I have a newer version of vim and it works correctly using your latest commit df182f55581137a47dacb6aacb706241f168ef37:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 10 2013 14:38:33) MS-Windows 32-bit GUI version with OLE support Compiled by mool@tororo

I'll check for errors from the old version of vim when I get a chance.

stefandtw commented 10 years ago

I can reproduce this now using a 2010 version of 7.3. I didn't get any error messages, but all replacements failed like in your case. I may dig a little deeper when I have more time.

stefandtw commented 10 years ago

Should be fixed now.

idbrii commented 10 years ago

With my vim7.3, full vim config, and df182f55581137a47dacb6aacb706241f168ef37, if I replace :w with :verbose w, I only get this output in :mess:

0/32 changes applied. See lines marked [ERROR].
not found in 'runtimepath': "indent/qf.vim"

The indent part appears to be a benign error (it only occurs when :filetype indent is enabled and using gvim -Nu NONE, which doesn't enable indent, doesn't work any better).