zsh-users
 help / color / mirror / code / Atom feed
* globbing index*
@ 2011-03-07 22:12 zzapper
  2011-03-07 22:36 ` Mikael Magnusson
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: zzapper @ 2011-03-07 22:12 UTC (permalink / raw)
  To: zsh-users

Hi
I'm often diffing two files with a glob knowing that only 2 files match.
say index.php and index2.php

so when I type 
> diff index*
I can assume that I will get, (but it will always be as clear)

> diff index.php index2.php

but is there an option to force diff to output the names of actual files 
compared?

(Having posed myself the problem I've realized that I can always tab expand)

> diff index*<TAB>




-- 
zzapper
http://zzapper.co.uk/ Technical Tips


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: globbing index*
  2011-03-07 22:12 globbing index* zzapper
@ 2011-03-07 22:36 ` Mikael Magnusson
  2011-03-07 22:38 ` Benjamin R. Haskell
  2011-03-09 23:29 ` Wayne Davison
  2 siblings, 0 replies; 6+ messages in thread
From: Mikael Magnusson @ 2011-03-07 22:36 UTC (permalink / raw)
  To: zzapper; +Cc: zsh-users

On 7 March 2011 23:12, zzapper <david@tvis.co.uk> wrote:
> Hi
> I'm often diffing two files with a glob knowing that only 2 files match.
> say index.php and index2.php
>
> so when I type
>> diff index*
> I can assume that I will get, (but it will always be as clear)
>
>> diff index.php index2.php
>
> but is there an option to force diff to output the names of actual files
> compared?
>
> (Having posed myself the problem I've realized that I can always tab expand)
>
>> diff index*<TAB>

diff -u?

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: globbing index*
  2011-03-07 22:12 globbing index* zzapper
  2011-03-07 22:36 ` Mikael Magnusson
@ 2011-03-07 22:38 ` Benjamin R. Haskell
  2011-03-07 22:55   ` zzapper
  2011-03-09 23:29 ` Wayne Davison
  2 siblings, 1 reply; 6+ messages in thread
From: Benjamin R. Haskell @ 2011-03-07 22:38 UTC (permalink / raw)
  To: zzapper; +Cc: zsh-users

On Mon, 7 Mar 2011, zzapper wrote:

> Hi
> I'm often diffing two files with a glob knowing that only 2 files match.
> say index.php and index2.php
>
> so when I type
>> diff index*
> I can assume that I will get, (but it will always be as clear)
>
>> diff index.php index2.php
>
> but is there an option to force diff to output the names of actual 
> files compared?
>
> (Having posed myself the problem I've realized that I can always tab 
> expand)
>
>> diff index*<TAB>
>

Personally I prefer to keep the unexpanded form for history purposes 
(next time the glob might match different files).

To output the names beforehand, you can make a function:

diff () { echo "Diffing: $@" >&2 ; command diff "$@" }

The 'command' precommand modifier prevents 'diff' from referring again 
to the 'function' of the same name.

-- 
Best,
Ben


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: globbing index*
  2011-03-07 22:38 ` Benjamin R. Haskell
@ 2011-03-07 22:55   ` zzapper
  0 siblings, 0 replies; 6+ messages in thread
From: zzapper @ 2011-03-07 22:55 UTC (permalink / raw)
  To: zsh-users

Benjamin R. Haskell wrote in news:alpine.LNX.2.01.1103071733100.2792@hp:

> On Mon, 7 Mar 2011, zzapper wrote:
> 
>> Hi
>> I'm often diffing two files with a glob knowing that only 2 files match.
>> say index.php and index2.php
>>
>> so when I type
>>> diff index*
>> I can assume that I will get, (but it will always be as clear)
>>
>>> diff index.php index2.php
>>
>> but is there an option to force diff to output the names of actual 
>> files compared?
>>
>> (Having posed myself the problem I've realized that I can always tab 
>> expand)
>>
>>> diff index*<TAB>
>>
> 
> Personally I prefer to keep the unexpanded form for history purposes 
> (next time the glob might match different files).
> 
> To output the names beforehand, you can make a function:
> 
> diff () { echo "Diffing: $@" >&2 ; command diff "$@" }
> 
> The 'command' precommand modifier prevents 'diff' from referring again 
> to the 'function' of the same name.
> 

Yep a wrapper seems the best way. My question might appear | be trivial but 
the number of times I've worried which file was which!

-- 
zzapper
http://zzapper.co.uk/ Technical Tips


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: globbing index*
  2011-03-07 22:12 globbing index* zzapper
  2011-03-07 22:36 ` Mikael Magnusson
  2011-03-07 22:38 ` Benjamin R. Haskell
@ 2011-03-09 23:29 ` Wayne Davison
  2011-03-09 23:56   ` Mikael Magnusson
  2 siblings, 1 reply; 6+ messages in thread
From: Wayne Davison @ 2011-03-09 23:29 UTC (permalink / raw)
  To: zzapper; +Cc: zsh-users

[-- Attachment #1: Type: text/plain, Size: 550 bytes --]

On Mon, Mar 7, 2011 at 2:12 PM, zzapper <david@tvis.co.uk> wrote:

> so when I type
> > diff index*
> I can assume that I will get, (but it will always be as clear)
>

I have Ctrl-D bound to delete-char-or-list, so I just type Ctrl-D after some
glob* item to see what it will expand to (without changing the
command-line).  The only bad thing is if I'm not at the end of the command
line it obviously will delete a character instead.  Using tab-expansion
followed by undo (Ctrl-underscore) is useful when I'm in the middle of the
command.

..wayne..

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: globbing index*
  2011-03-09 23:29 ` Wayne Davison
@ 2011-03-09 23:56   ` Mikael Magnusson
  0 siblings, 0 replies; 6+ messages in thread
From: Mikael Magnusson @ 2011-03-09 23:56 UTC (permalink / raw)
  To: Wayne Davison; +Cc: zzapper, zsh-users

On 10 March 2011 00:29, Wayne Davison <wayned@users.sourceforge.net> wrote:
> On Mon, Mar 7, 2011 at 2:12 PM, zzapper <david@tvis.co.uk> wrote:
>
>> so when I type
>> > diff index*
>> I can assume that I will get, (but it will always be as clear)
>>
>
> I have Ctrl-D bound to delete-char-or-list, so I just type Ctrl-D after some
> glob* item to see what it will expand to (without changing the
> command-line).  The only bad thing is if I'm not at the end of the command
> line it obviously will delete a character instead.  Using tab-expansion
> followed by undo (Ctrl-underscore) is useful when I'm in the middle of the
> command.

Note though ctrl-d won't show what a glob expands to, for that you
want list-expand, not list-choices (which does what ctrl-d does
regardless of where on the line you are).

For example if you have *t and press ctrl-d, you will see things that
don't end with a t (because completing with glob_complete set will
always insert a * at the cursor), while list-expand will only show
exactly what it matches, and also works independently of
glob_complete.

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-03-09 23:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-07 22:12 globbing index* zzapper
2011-03-07 22:36 ` Mikael Magnusson
2011-03-07 22:38 ` Benjamin R. Haskell
2011-03-07 22:55   ` zzapper
2011-03-09 23:29 ` Wayne Davison
2011-03-09 23:56   ` Mikael Magnusson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).