1

TL;DR I have macros in each %m captured by errorformat after :make. I'd like to have a copy of the file in another split and apply all the macros (so to have a fixed file) and then do a :windo diffthis to let the user (mostly me) to choose to diffget the fixed code or not.

Question: I am planning to do ggyG and then :vnew P then do a recursive macro call until I exhausted all :cnext. However the error after exhaustion would stop the whole process which the :windo diffthis cannot start. Is there a way to overcome this?


Background

To streamline my daily workflow, I'd like to have the Quick Fix Window not only to show where the errors are, but to suggest a way to quick fix.

Assuming that I have customized makeprg and errorformat, such that errorformat has %m capturing a vi macro that would fix the issue when run.

For example if I am working with jQuery and has this in line 1:

var top = $element.top;

:make will capture this and errorformat knows that %l is 1 and %m would be 1G/\.top<cr>i.offset()<esc> (when run, would correctly insert offset() before .top)

Currently I am like using :nnoremap Z <C-w><C-w>f<space>ly$<C-w><C-w>:@0<cr> so after I did :cnext I can use Z to apply the fix.

I'd like to make vi smarter so vi could get me a fixed version of the code and I could check if vi 's suggestions are acceptable or not. Therefore I asked the question.

By the way I am also interested in how Fugitive managed to create buffers that starts with fugitive:// and there are no warning if I just run :q.

  • :help 'buftype' – Rich Nov 9 '17 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.