Loading ...
Sorry, an error occurred while loading the content.

RE: How to "make" in a separate window?

Expand Messages
  • Goli, Rajesh (Rajesh)
    Thanks a lot Eric, Luc. This is a asynchronous way of doing things. But this works almost the way I wanted it to. This is what I did: .gvimrc: noremap
    Message 1 of 8 , May 27, 2005
    • 0 Attachment
      Thanks a lot Eric, Luc.
      This is a asynchronous way of doing things. But this works almost the way I
      wanted it to.

      This is what I did:

      .gvimrc:

      noremap <F9> <ESC>:!/home/rajesh/scripts/mkvi.pl<CR>

      This way is not exactly the same as typing :make, but I just have to tap F9
      to begin make.

      /home/rajesh/scripts/mkvi.pl:
      #!/usr/bin/perl

      use POSIX ":sys_wait_h";

      $errorFile = '/home/rajesh/bldlog.log';
      $vim = '/opt/exp/bin/gvim';

      print $ARGV[0] . "\n";

      if (!defined($kidpid = fork()))
      {
      # fork returned undef, so failed
      die "Cannot fork: $!";
      }
      elsif ($kidpid != 0)
      {
      # Parent exits
      exit(0);
      }

      system("make " . '>' . " $errorFile " . '2>&1');

      sendVimCommand("let mp=&makeprg");
      sendVimCommand("set makeprg=cat\ /home/golirajesh/bldlog.log");
      sendVimCommand("make! $errorFile");
      sendVimCommand("let &makeprg=mp");
      sendVimCommand("cwin");

      sub sendVimCommand {
      $command = shift;
      system($vim,"--remote-send","<ESC>:$command<CR>");
      }

      -Rajesh

      -----Original Message-----
      From: hermitte@... [mailto:hermitte@...]
      Sent: Friday, May 27, 2005 5:07 PM
      To: Goli, Rajesh (Rajesh)
      Cc: Eric Arnold; vim@...
      Subject: RE: How to "make" in a separate window?


      Hello.

      "Goli, Rajesh (Rajesh)" <golirajesh@...> wrote:

      > I tried doing something on the very same lines.
      > First I changed my .gvimrc to include
      >
      > set shellpipe=\ " Shellpipe is just a space so the errorfile is an
      > argument to makeprogram
      > set mp=/home/rajesh/scripts/mkvi.pl
      >
      > So when I executed :make it actually executed something like
      > /home/rajesh/scripts/mkvi.pl /tmp/errorfile
      >
      > My script looked something like:
      > [...]
      > This works to the extent that I get the prompt back immediately,
      > but vim cribs saying it cant open the errorfile. Can you see
      > something that I am not doing right?

      Save the result of the compilation in a file.
      Then, once the compilation is finished, load the file with:
      :let mp=&makeprg
      :set makeprg=cat\ $*
      :make name-of-the-file
      :let &makeprg=mp

      If Vim supports |+clientserver|, you should be able to send thoose
      commands to vim from your perl script.


      --
      Luc Hermitte
    Your message has been successfully submitted and would be delivered to recipients shortly.