2

First off, I'm writing this for my setup at work, which is entirely on Windows. I'd imagine it would be quite a bit easier if I was able to use a proper terminal.

I've written a function in my vimrc that lets me run a syntax checker for the obscure programming language we use here. I'd like to read the output from that syntax checker into a variable in the function, which I can then use to set some linenumber marks or output to a temp buffer (like Syntastic).

I browsed through the helpfile and found redir =>, but it doesn't seem to work like I'd expect it to.

" SYNTAX CHECK FOR PROGRESS
" =========================
function! CheckSyntaxCustom()
  if (&ft=='progress')
  redir => progress_output
    :execute '0read !c:\progress\openedge11_3\bin\_progres.exe -1 -b -Mm 16384 -pf c:\progress\openedge11_3\startup.pf -p c:\code\custom\syntax.p -param %:p'
  redir end
  :echom progress_output
  endif
endfunction 

Seems like I can't manipulate progress_output. Ideally I'd like it to return a string that I can then use with :execute, but right now it just pastes the command prompt output to the line below the cursor. I'm fairly new to vimscript so I could be completely wrong on what redir should be used for. Any advice on how to accomplish what I'm looking to do?

2

Vim already includes everything you need to achieve what you are looking for, as long as it is properly configured for your environment.

Take a look at the following Vim help pages:

You can also look at Syntastic syntax plugins that include various examples for 'errorformat'. You can find a tool that you know (or that you have access to) and use those entries as an example for your development. While I don't personally use Syntastic, do consider creating a Pull Request to have your language included in it.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.