Friday, September 21, 2012

Re: [mszamot@gmail.com: Re: a small plugin for :call system() in vim]

On 2012-09-22, Marcin Szamotulski wrote:

> On 15:26 Fri 21 Sep , Gary Johnson wrote:
> > On 2012-09-21, Marcin Szamotulski wrote:
> > > On 13:54 Fri 21 Sep , Gary Johnson wrote:
> > > > On 2012-09-21, Marcin Szamotulski wrote:
> > > > > On 19:33 Fri 21 Sep , Marc Weber wrote:
> > > > > > Excerpts from Marcin Szamotulski's message of Fri Sep 21 19:21:23 +0200 2012:
> > > > > > > Hello,
> > > > > > >
> > > > > > > I just have found a neat way for doing:
> > > > > > > :echo system('command')
> > > > > >
> > > > > > why is echo system('command') better than :! ?
> > > > > >
> > > > > > Using :! you can stop it using ctrl-c again.
> > > > > > The only advantage I could see is that % is not treated specially.
> > > > > > Ah, its about completion ?
> > > > > Yes it is! and how less you need to type, and how nice it looks ;)
> > > >
> > > > This must be for shells that don't have command completion? From
> > > > both vim and gvim on my Linux system, command completion from :!
> > > > works fine.
> > > >
> > > > Regards,
> > > > Gary
> > >
> > > The problem is that there is no completion on the vim command line when
> > > you type:
> > > :echo system("....
> >
> > I don't understand why anyone would want to use ":echo system('..."
> > instead of ":!...".
> >
> > Regards,
> > Gary
>
> In terminal vim "!..." jumps back and forth to the terminal. I prefer to
> stay inside vim. One of the reasons is quite trivial: I use different
> background color in vim (a dark one) and terminal (rather light). And
> there is a small delay time when eyes adjust to another contrast.

OK, I see now. I usually have the alternate screen disabled (t_ti
and t_te both empty) so I don't see that problem. With those set,
the switching back and forth when using ":!" _is_ kind of annoying.

I also found that ":echo system('..." works well on Windows: it
avoids the new Command Prompt window when using gvim and avoids the
disappearing output when using vim.

In all cases, using ":echo system('..." allows you to use Vim's
built-in pager to scroll back and forth through long outputs without
having to pipe into less.

Now that I understand, that _is_ a useful trick.

Regards,
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: