On 2009-02-27, Ben Fritz wrote:
> On Feb 26, 11:46 am, Gary Johnson <[email protected]> wrote:
>
> >
> > Following the examples in ":help makeprg", how about this:
> >
> > :set makeprg=make\ $*\ \\\|\ tee\ make.out
> >
>
> Hmm, that looks promising for my needs.
>
> Might it be better to append make.out to the shellpipe option on a
> unix system? The default for unix uses tee already.
>
> I used this to try it out, and it seems to work okay:
>
> if has('unix')
> autocmd VimEnter * let &shellpipe = &shellpipe . ' make.out'
> endif
I think you're right--that does seem cleaner and uses one fewer
processes.
> I had to use the VimEnter event because shellpipe is set after reading
> all the init files. Unfortunately, this means I can't use "-c make!"
> to do the compile.
That I don't understand. ":help shellpipe" says,
The initialization of this option is done after reading the
".vimrc" and the other initializations, so that when the 'shell'
option is set there, the 'shellpipe' option changes
automatically, unless it was explicitly set before.
I guess -c may be in the set of "other initializations", but it
seems to me that if you set 'shellpipe' in your ~/.vimrc, that would
make it "explicitly set before" and immune from being re-initialized
by vim.
In fact, I tried the following experiment. I added this line to my
~/.vimrc:
let &shellpipe.=" make.out"
and then started vim like this:
vim -c 'set shellpipe?'
and when vim opened, this string was in the command/status line:
shellpipe=| tee make.out
Oh, OK, so 'shellpipe' wasn't initialized before it was accessed by
the let command, so it was set to "| tee" instead of "2>&1| tee".
Next I put this command in my ~/.vimrc instead:
let &shellpipe="2>&1| tee make.out"
Then I created a hello.c file in the current directory, with an
error in it, and executed
vim -c 'make! hello'
The quickfix list contained the error and make.out contained the
full output of make.
So, you don't need to use an autocommand to set 'shellpipe' unless
you want vim to determine the initial value according to your
'shell'. If you set it as I did, you can continue to use "-c
make!".
Regards,
Gary
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---