! command and able to make changes on the vim

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

! command and able to make changes on the vim

jose isaias cabrera-2

Greetings!

I want to run a command, ie.

!dir

but I want to keep the DOS prompt open, but also able to edit the files on
vim.  Is this possible?

thanks,

jos?

Reply | Threaded
Open this post in threaded view
|

Re: ! command and able to make changes on the vim

Stephen R Laniel
On Wed, Aug 10, 2005 at 02:18:30PM -0400, jose isaias cabrera wrote:
> I want to run a command, ie.
>
> !dir
>
> but I want to keep the DOS prompt open, but also able to edit the files on
> vim.  Is this possible?

Well, ':shell' will open a remote shell and leave it open.
'!' will read the contents of a shell command into the
current buffer. I don't know how to both read the shell
command into the buffer *and* open an external shell which
stays open after the command's output gets read into the
buffer.

--
Stephen R. Laniel
[hidden email]
+(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: ! command and able to make changes on the vim

jose isaias cabrera-2
On 14:24 Wed 10 Aug     , Stephen R Laniel wrote:

> On Wed, Aug 10, 2005 at 02:18:30PM -0400, jose isaias cabrera wrote:
> > I want to run a command, ie.
> >
> > !dir
> >
> > but I want to keep the DOS prompt open, but also able to edit the files on
> > vim.  Is this possible?
>
> Well, ':shell' will open a remote shell and leave it open.
> '!' will read the contents of a shell command into the
> current buffer. I don't know how to both read the shell
> command into the buffer *and* open an external shell which
> stays open after the command's output gets read into the
> buffer.

let me put it in another way:  I want to be able to edit the vim file
while the program is running.  I am really compiling a D source code,
but I want to keep the output of the compile, or keeping the output of
an execution of a program and also be able to edit the source code with
the DOS command still open.  The problem is that I keep having to open a
command prompt to keep it open, but I just want to do everything from
vim.

Any ideas?

thanks.


Reply | Threaded
Open this post in threaded view
|

Re: ! command and able to make changes on the vim

A.J.Mechelynck
In reply to this post by jose isaias cabrera-2
----- Original Message -----
From: "jose isaias cabrera" <[hidden email]>
To: "Vim" <[hidden email]>
Sent: Wednesday, August 10, 2005 8:18 PM
Subject: ! command and able to make changes on the vim


>
> Greetings!
>
> I want to run a command, ie.
>
> !dir
>
> but I want to keep the DOS prompt open, but also able to edit the files on
> vim.  Is this possible?
>
> thanks,
>
> jos?

The easiest way to do it is to launch the dos box manually, not from Vim.

In Windows (at least in NT-2K-XP) you can also use

    :!start cmd /Kdir

which will open an independent dos box; the latter will return to the prompt
after executing the command, but the "start" command will have terminated
long before, returning control to Vim.

You may have to use something like (untested)

    :$r !start cmd /Kdir

to avoid a temporary dos box for the "start" command, with a "Press any key"
message at the bottom.

Best regards,
Tony.


Reply | Threaded
Open this post in threaded view
|

Re: ! command and able to make changes on the vim

jose isaias cabrera-2

Tony,

> In Windows (at least in NT-2K-XP) you can also use
>
>    :!start cmd /Kdir

This one works.  I'll use this one.

>
> You may have to use something like (untested)
>
>    :$r !start cmd /Kdir
>
> to avoid a temporary dos box for the "start" command, with a "Press any
> key" message at the bottom.

This one, however, eats up all of the output of the start AND the cmd, so,
not so much. :-)  This is the idea, though.

thanks.

jos?

Reply | Threaded
Open this post in threaded view
|

Re: ! command and able to make changes on the vim

A.J.Mechelynck
----- Original Message -----
From: "jose isaias cabrera" <[hidden email]>
To: "Tony Mechelynck" <[hidden email]>; "Vim" <[hidden email]>
Sent: Wednesday, August 10, 2005 8:42 PM
Subject: Re: ! command and able to make changes on the vim


>
> Tony,
>
>> In Windows (at least in NT-2K-XP) you can also use
>>
>>    :!start cmd /Kdir
>
> This one works.  I'll use this one.
>
>>
>> You may have to use something like (untested)
>>
>>    :$r !start cmd /Kdir
>>
>> to avoid a temporary dos box for the "start" command, with a "Press any
>> key" message at the bottom.
>
> This one, however, eats up all of the output of the start AND the cmd, so,
> not so much. :-)  This is the idea, though.
>
> thanks.
>
> jos?

To get the output of the command back into Vim, use redirection:

    :!start cmd /Cdir >%TEMP%\dir.log

... and later ...

    :view $TEMP/dir.log

The > redirects the output of the dir command (or of any command) to a file
of your choosing. After the command finishes, you can open that file in Vim.
(BTW, cmd /C executes one command then closes; with /K it executes the
command then goes back to the prompt.)

HTH,
Tony.


Reply | Threaded
Open this post in threaded view
|

RE: ! command and able to make changes on the vim

Keith W. Roberts
In reply to this post by jose isaias cabrera-2
 

> -----Original Message-----
> From: jose isaias cabrera [mailto:[hidden email]]
> Sent: Wednesday, August 10, 2005 11:27 AM
> To: Stephen R Laniel
> Cc: [hidden email]
> Subject: Re: ! command and able to make changes on the vim
>
> On 14:24 Wed 10 Aug     , Stephen R Laniel wrote:
> > On Wed, Aug 10, 2005 at 02:18:30PM -0400, jose isaias cabrera wrote:
> > > I want to run a command, ie.
> > >
> > > !dir
> > >
> > > but I want to keep the DOS prompt open, but also able to
> edit the files on
> > > vim.  Is this possible?
> >
> > Well, ':shell' will open a remote shell and leave it open.
> > '!' will read the contents of a shell command into the
> > current buffer. I don't know how to both read the shell
> > command into the buffer *and* open an external shell which
> > stays open after the command's output gets read into the
> > buffer.
>
> let me put it in another way:  I want to be able to edit the vim file
> while the program is running.  I am really compiling a D source code,
> but I want to keep the output of the compile, or keeping the output of
> an execution of a program and also be able to edit the source
> code with
> the DOS command still open.  The problem is that I keep
> having to open a
> command prompt to keep it open, but I just want to do everything from
> vim.
>
> Any ideas?
>
> thanks.

I don't think you can both open a "detached" DOS bos (ie, with :!start)
*and* get the output back to vim ... at least not without sending the output
of the compile to a file.  If you edit that same file in vim, you can either
use :e! to "refresh" its contents or :set autoread.

-Keith