Friday, October 10, 2014

Re: Building the quickfix window from VimL

On 10 October 2014, David Fishburn <dfishburn.vim@gmail.com> wrote:
> 7.4.1-466 Windows 7 32 bit
>
> I have a plugin with formats some code.
>
> But in order to format it, it has to parse it. During the parsing, it
> can report errors.
>
> I want to basically open the quickfix window and give the usual output
> you would usually supply with a :make.
>
> So I create a new buffer.
> :setlocal filetype=qf
[...]

Don't do that. Use the existing quickfix mechanisms, instead of
emulating their functionality in your plugin.

If your plugin produces the errors as tuples of (file, line number,
column number, error text, ...) then build a quickfix list, call
setqflist() (see ":help setqflist()" for details), and you're done, you
can run :copen to open the error window.

If on the other hand you have the errors as text lines, then set
errorformat to match the relevant information, call cgetexpr() to parse
the errors, and again, you're ready to go.

/lcd

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: