zsh-users
 help / color / mirror / code / Atom feed
* Re: cd ..<tab>?
  2002-01-29 10:20 cd ..<tab>? Bo Thorsen
@ 2002-01-29 10:18 ` Sven Wischnowsky
  2002-01-29 23:10   ` Dennis Haney
  0 siblings, 1 reply; 7+ messages in thread
From: Sven Wischnowsky @ 2002-01-29 10:18 UTC (permalink / raw)
  To: zsh-users; +Cc: Bo Thorsen


Bo Thorsen wrote:

> Hi all,
> 
> I'm just giving zsh yet another try, but my biggest beef with it is still 
> there:
> 
> > cd ..<tab>
> 
> doesn't expand to ../ which is quite annoying on a danish keyboard. Tab is 
> easily hit but / is shift+7. Small issue, but when something's annoying, it 
> only grows worse.
> 
> I have searched the web and the manual without finding this. I expect there 
> is some way of setting up completion to this, but I haven't figured it out 
> yet.

I assume you're using the new completion system, i.e., you call

  autoload -U compinit
  compinit

in any of the init files.

Then you can just do:

  zstyle ':completion:*' special-dirs ..

to make `..' be considered a possible match (and hence it will get the
slash appended).


Bye
  Sven

-- 
Sven Wischnowsky                           wischnow@berkom.de


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

* cd ..<tab>?
@ 2002-01-29 10:20 Bo Thorsen
  2002-01-29 10:18 ` Sven Wischnowsky
  0 siblings, 1 reply; 7+ messages in thread
From: Bo Thorsen @ 2002-01-29 10:20 UTC (permalink / raw)
  To: zsh-users

Hi all,

I'm just giving zsh yet another try, but my biggest beef with it is still 
there:

> cd ..<tab>

doesn't expand to ../ which is quite annoying on a danish keyboard. Tab is 
easily hit but / is shift+7. Small issue, but when something's annoying, it 
only grows worse.

I have searched the web and the manual without finding this. I expect there 
is some way of setting up completion to this, but I haven't figured it out 
yet.

Could some zsh guru please show me how to do this? And cc me since I'm not on 
the list.

Thanks a lot.

Bo.

-- 

     Bo Thorsen                 |   Praestevejen 4
     Free software developer    |   5290 Marslev
     SuSE Labs                  |   Denmark


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

* Re: cd ..<tab>?
  2002-01-29 10:18 ` Sven Wischnowsky
@ 2002-01-29 23:10   ` Dennis Haney
  2002-01-30  1:12     ` Bart Schaefer
  0 siblings, 1 reply; 7+ messages in thread
From: Dennis Haney @ 2002-01-29 23:10 UTC (permalink / raw)
  To: Sven Wischnowsky; +Cc: zsh-users

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

Sven Wischnowsky wrote:

>Bo Thorsen wrote:
>
>>Hi all,
>>
>>I'm just giving zsh yet another try, but my biggest beef with it is still 
>>there:
>>
>>>cd ..<tab>
>>>
>>doesn't expand to ../ which is quite annoying on a danish keyboard. Tab is 
>>easily hit but / is shift+7. Small issue, but when something's annoying, it 
>>only grows worse.
>>
>>I have searched the web and the manual without finding this. I expect there 
>>is some way of setting up completion to this, but I haven't figured it out 
>>yet.
>>
>
>I assume you're using the new completion system, i.e., you call
>
>  autoload -U compinit
>  compinit
>
>in any of the init files.
>
>Then you can just do:
>
>  zstyle ':completion:*' special-dirs ..
>
>to make `..' be considered a possible match (and hence it will get the
>slash appended).
>
Is there a way to make this work properly with setopt GLOB_DOTS?
Such that .. is not tabcompleted once you have already entered a directory?


-- 
Dennis
use Inline C => qq{void p(char*g){printf("Just Another %s Hacker\n",g);}};p("Perl");



[-- Attachment #2: Type: text/html, Size: 1671 bytes --]

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

* Re: cd ..<tab>?
  2002-01-29 23:10   ` Dennis Haney
@ 2002-01-30  1:12     ` Bart Schaefer
  2002-02-05 17:19       ` Dennis Haney
       [not found]       ` <3C60140C.6020006@davh.dk>
  0 siblings, 2 replies; 7+ messages in thread
From: Bart Schaefer @ 2002-01-30  1:12 UTC (permalink / raw)
  To: Dennis Haney; +Cc: zsh-users

On Jan 30, 12:10am, Dennis Haney wrote:
> Subject: Re: cd ..<tab>?
> 
> Sven Wischnowsky wrote:
> >
> >  zstyle ':completion:*' special-dirs ..
> >
> >to make `..' be considered a possible match (and hence it will get the
> >slash appended).
> >
> Is there a way to make this work properly with setopt GLOB_DOTS?

Just make the style more specific:

  zstyle ':completion:*:(cd|chdir|pushd|popd):*' special-dirs ..

You might also check the documentation for the ignore-parents style.


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

* Re: cd ..<tab>?
  2002-01-30  1:12     ` Bart Schaefer
@ 2002-02-05 17:19       ` Dennis Haney
       [not found]       ` <3C60140C.6020006@davh.dk>
  1 sibling, 0 replies; 7+ messages in thread
From: Dennis Haney @ 2002-02-05 17:19 UTC (permalink / raw)
  To: zsh-users

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

  Bart Schaefer wrote:

>On Jan 30, 12:10am, Dennis Haney wrote:
>
>>Subject: Re: cd ..<tab>?
>>
>>Sven Wischnowsky wrote:
>>
>>> zstyle ':completion:*' special-dirs ..
>>>
>>>to make `..' be considered a possible match (and hence it will get the
>>>slash appended).
>>>
>>Is there a way to make this work properly with setopt GLOB_DOTS?
>>
>
>Just make the style more specific:
>
>  zstyle ':completion:*:(cd|chdir|pushd|popd):*' special-dirs ..
>
How is that going to help me?

>
>You might also check the documentation for the ignore-parents style.
>
ignore-parent works the wrong way...

It want to ignore '..' when it is a stupid choice.
eg.
mkdir Z
cd Z/[tab]
should NOT complete to 'cd Z/../'
(unless CHASE_DOTS is on and 'cd Z/..' will be different from 'cd .')

likewise...
mkdir Z
mkdir Z/Y
cd Z/[tab]
should NOT give me '..' as a choice, but just complete to 'cd Z/Y'
(unless CHASE_DOTS is on and 'cd Z/..' will be different from 'cd .')

-- 
Dennis
use Inline C => qq{void p(char*g){printf("Just Another %s Hacker\n",g);}};p("Perl");



[-- Attachment #2: Type: text/html, Size: 1880 bytes --]

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

* Re: cd ..<tab>?
       [not found]       ` <3C60140C.6020006@davh.dk>
@ 2002-02-05 17:46         ` Bart Schaefer
  2002-02-05 18:26           ` Dennis Haney
  0 siblings, 1 reply; 7+ messages in thread
From: Bart Schaefer @ 2002-02-05 17:46 UTC (permalink / raw)
  To: zsh-users, Dennis Haney

On Feb 5,  6:19pm, Dennis Haney wrote:
}
} Bart Schaefer wrote:
} 
} >>Is there a way to make this work properly with setopt GLOB_DOTS?
} >
} >Just make the style more specific:
} >
} >  zstyle ':completion:*:(cd|chdir|pushd|popd):*' special-dirs ..
} >
} How is that going to help me?

Apparently I misunderstood the question.  It'll help by making ".." not
be completed for commands other than "cd" et al., which was the only
way I could think of (at the time) that GLOB_DOTS could be involved.

} >You might also check the documentation for the ignore-parents style.
} >
} ignore-parent works the wrong way...

Aha.

} It want to ignore '..' when it is a stupid choice.
} eg.
} mkdir Z
} cd Z/[tab]
} should NOT complete to 'cd Z/../'
} (unless CHASE_DOTS is on and 'cd Z/..' will be different from 'cd .')

This is a case where you need 'zstyle -e'.  You want the special-dirs
style to be non-empty only in certain circumstances.

This completes `..' only if the prefix is either empty, or has a leading
`.' and contains no slashes:

    zstyle -e ':completion:*' special-dirs \
        '[[ $PREFIX = (|.[^/]#) ]] && reply=(..)'

To find out that `Z/..' is not the same directory as `.' requires a bit
of extra work, which I don't have time to do just now, but you can see
how you'd just insert that into the conditions under which the reply
array is set by the style.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

* Re: cd ..<tab>?
  2002-02-05 17:46         ` Bart Schaefer
@ 2002-02-05 18:26           ` Dennis Haney
  0 siblings, 0 replies; 7+ messages in thread
From: Dennis Haney @ 2002-02-05 18:26 UTC (permalink / raw)
  Cc: zsh-users

Bart Schaefer wrote:

>On Feb 5,  6:19pm, Dennis Haney wrote:
>}
>} Bart Schaefer wrote:
>} 
>} >>Is there a way to make this work properly with setopt GLOB_DOTS?
>} >
>
>} It want to ignore '..' when it is a stupid choice.
>} eg.
>} mkdir Z
>} cd Z/[tab]
>} should NOT complete to 'cd Z/../'
>} (unless CHASE_DOTS is on and 'cd Z/..' will be different from 'cd .')
>
>This is a case where you need 'zstyle -e'.  You want the special-dirs
>style to be non-empty only in certain circumstances.
>
>This completes `..' only if the prefix is either empty, or has a leading
>`.' and contains no slashes:
>
>    zstyle -e ':completion:*' special-dirs \
>        '[[ $PREFIX = (|.[^/]#) ]] && reply=(..)'
>
heh Thanks. I didnt know I could run a "script" here :)

zstyle -e ':completion:*' special-dirs \
   '[[ $PREFIX = (../)#(|.|..) ]] && reply=(..)'

This will continue to work with cd ../../../..[tab] while working with 
cd .[tab]

Would you please add your (or my) little script to the documentation 
under special-dirs? :)


>
>
>To find out that `Z/..' is not the same directory as `.' requires a bit
>of extra work, which I don't have time to do just now, but you can see
>how you'd just insert that into the conditions under which the reply
>array is set by the style.
>
I dont use CHASE_DOTS luckely :)

>
>http://www.well.com/user/barts              http://www.brasslantern.com
>
>Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   
>


-- 
Dennis
use Inline C => qq{void p(char*g){printf("Just Another %s Hacker\n",g);}};p("Perl");




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

end of thread, other threads:[~2002-02-05 18:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-29 10:20 cd ..<tab>? Bo Thorsen
2002-01-29 10:18 ` Sven Wischnowsky
2002-01-29 23:10   ` Dennis Haney
2002-01-30  1:12     ` Bart Schaefer
2002-02-05 17:19       ` Dennis Haney
     [not found]       ` <3C60140C.6020006@davh.dk>
2002-02-05 17:46         ` Bart Schaefer
2002-02-05 18:26           ` Dennis Haney

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).