Delivering text to vim.

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

Delivering text to vim.

John Culleton-3
Assume I am in a Gvim session and I hit an F-key which in turn
executes an external program. The external program directs text
to sysout. Can I make this appear in the Gvim text? Or do I need
to direct it to a temp file and have a
:read
function in the script?

Linux system and probably Tcl/Tk as the programming language.
--
John Culleton
Books with answers to marketing and publishing questions:
http://wexfordpress.com/tex/shortlist.pdf

Book coaches, consultants and packagers:
http://wexfordpress.com/tex/packagers.pdf

Reply | Threaded
Open this post in threaded view
|

RE: Delivering text to vim.

Suresh Govindachar`

   John R. Culleton Sent April 12, 2006 6:43 AM
 
  > Assume I am in a Gvim session and I hit an F-key which in turn
  > executes an external program. The external program directs text
  > to sysout. Can I make this appear in the Gvim text? Or do I need
  > to direct it to a temp file and have a :read function in the
  > script?
  >
  > Linux system and probably Tcl/Tk as the programming language.

  Map the F-key to something like :read !<external program>

  --Suresh

Reply | Threaded
Open this post in threaded view
|

Re: Delivering text to vim.

Dr. Johannes Zellner
In reply to this post by John Culleton-3
On Wed, Apr 12, 2006 at 09:42:54AM -0400, John R. Culleton wrote:
> Assume I am in a Gvim session and I hit an F-key which in turn
> executes an external program. The external program directs text
> to sysout. Can I make this appear in the Gvim text? Or do I need
> to direct it to a temp file and have a
> :read
> function in the script?

:read !ls -l


??

--
Johannes
Reply | Threaded
Open this post in threaded view
|

Re: Delivering text to vim.

Mikołaj Machowski
In reply to this post by John Culleton-3
Dnia środa, 12 kwietnia 2006 15:42, John R. Culleton napisał:
> Assume I am in a Gvim session and I hit an F-key which in turn
> executes an external program. The external program directs text
> to sysout. Can I make this appear in the Gvim text? Or do I need
> to direct it to a temp file and have a
>
> :read
>
> function in the script?

For Vim6.x use :redir ::

    :redir @a
    :silent !ls
    :redir END

For Vim7 also system() ::

    :let a = system('ls')

m.
--
        E478: Don't panic!

Reply | Threaded
Open this post in threaded view
|

Re: Delivering text to vim.

Zbigniew Kowalski
In reply to this post by Dr. Johannes Zellner
also you can use:
. !<program>
on any empty line
(if you don't like 'read')

HTM
zbikow

Dnia 12-04-2006 o godz. 16:12 Dr. Johannes Zellner napisał(a):

> On Wed, Apr 12, 2006 at 09:42:54AM -0400, John R. Culleton wrote:
> > Assume I am in a Gvim session and I hit an F-key which in turn
> > executes an external program. The external program directs text
> > to sysout. Can I make this appear in the Gvim text? Or do I need
> > to direct it to a temp file and have a
> > :read
> > function in the script?
>
> :read !ls -l
>
>
> ??
>
> --
> Johannes
>
Zbigniew Kowalski
http://zbikow1.webpark.pl/


Reply | Threaded
Open this post in threaded view
|

RE: Delivering text to vim.

Halim, Salman
In reply to this post by Mikołaj Machowski
Redir doesn't work for commands that don't post their output in the Vim
window (such as system commands).  If it is your intention to post the
output of a system command into your buffer, you can instead do:

:r!ls

If it is simply to SEE the output, then system() is sufficient -- I'm
fairly certain that it exists in Vim 6.3+ and doesn't require 7.

Salman.

> > Assume I am in a Gvim session and I hit an F-key which in turn
> > executes an external program. The external program directs text to
> > sysout. Can I make this appear in the Gvim text? Or do I need to
> > direct it to a temp file and have a
> >
> > :read
> >
> > function in the script?
>
> For Vim6.x use :redir ::
>
>     :redir @a
>     :silent !ls
>     :redir END
>
> For Vim7 also system() ::
>
>     :let a = system('ls')
>
> m.
Reply | Threaded
Open this post in threaded view
|

Re: Delivering text to vim.

Mikołaj Machowski
Dnia środa, 12 kwietnia 2006 19:45, Halim, Salman napisał:
> Redir doesn't work for commands that don't post their output in the Vim
> window (such as system commands).  If it is your intention to post the

For me "ls" worked.
>
> output of a system command into your buffer, you can instead do:
> :r!ls
>
But I misread OP - I thought in lines "delivering system output to Vim
script" not file :)

m.