Friday, September 3, 2010

Re: external compiler output into window/buffer/quickfix from vim

On 2010-09-03, Jeri Raye wrote:
> Hi,
>
> I'm experimenting in getting my compiler output redirected into vim,
> while editing my file to get it bugfree.
>
> When I compile my file in my other program the command is as below:
>
> vcom -work work -2002 -explicit C:/projects/iic_slave_pa_a0.vhd
>
> In this line you can see that:
> 1) vcom is the external compiler
> 2) "-work work -2002 -explicit" are the given arguments (without the
> double qoute signs ")
> 3) C:/projects/iic_slave_pa_a0.vhd is the file that is compiled.
>
> In the program the output is something like this:
> # Model Technology ModelSim ALTERA vcom 6.5b Compiler 2009.10 Oct 1 2009
> # -- Loading package standard
...
> # -- Compiling entity iic_slave_pa_a0
> # -- Compiling architecture a0 of iic_slave_pa_a0
>
>
> If I'm editing my file "iic_slave_pa_a0.vhd" in vim and I want to
> compile it, how should I call this external compiler with these arguments?
>
> I've come this far, but this still doesn't work:
>
> nmap <F9> :set makeprg=vcom\ %<<CR>!make [-work work 2002 -explicit] >&1<CR>
>
> What's wrong with this?

I don't know what you are trying to do with the [ and ], but they
shouldn't be there.

Since the compiler needs the file's extension, the file name
argument should be % and not %<.

If you want to use Vim's :make command, then you need to execute
:make, not :!make.

Vim takes care of output redirection, so the >&1 should not be
there.

To fix this, first of all I would put all the compiler options into
'makeprg' and set 'makeprg' once rather than each time you compile.

:set makeprg=vcom\ -work\ work\ -2002\ -explicit\ %

Then to compile your file, just execute

:make

or if you want to just hit <F9>, map <F9> like this:

:map <F9> :make<CR>

You will probably have to change 'errorformat' to recognize the
output format of your compiler as well, but I don't know what your
compiler's error messages look like.

HTH,
Gary

--
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

No comments:

Post a Comment