zsh-users
 help / color / mirror / code / Atom feed
* Completion of ~ to include dirstack?
@ 2007-10-07  3:23 Boyd Adamson
  2007-10-07  9:16 ` Stephane Chazelas
  2007-10-07 18:51 ` Bart Schaefer
  0 siblings, 2 replies; 3+ messages in thread
From: Boyd Adamson @ 2007-10-07  3:23 UTC (permalink / raw)
  To: zsh-users

I use the following options:

setopt auto_pushd pushd_ignore_dups

This allows me to do
% dirs -v
0       /opt
1       /export/home
2       /usr
3       ~
% cd ~1
% pwd
/usr

That's great.

I can also change to a dir with cd ~-2 (second from the end)

Now, I have other options set (like verbose menuselection) set, and
completion works on this:

% cd ~-<tab>
directory stack
0 -- /export/home/boyd
1 -- /export/home
2 -- /opt

But I get the list in *reverse* order. What I'd really like is this completion:

% cd ~<tab>
user
adm       boyd      fred      listen    noaccess  nobody4   root
student   uucp
bin       daemon    gdm       lp        nobody    nuucp     smmsp
sys       webservd

to include a section with the directory stack.

I have a feeling that this is a one-liner, but I've always found the
zstyle system a bit bewildering.

Can this be done? And if so, is there a general place to get this kind
of info (apart from this list :) )

Boyd


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

* Re: Completion of ~ to include dirstack?
  2007-10-07  3:23 Completion of ~ to include dirstack? Boyd Adamson
@ 2007-10-07  9:16 ` Stephane Chazelas
  2007-10-07 18:51 ` Bart Schaefer
  1 sibling, 0 replies; 3+ messages in thread
From: Stephane Chazelas @ 2007-10-07  9:16 UTC (permalink / raw)
  To: Boyd Adamson; +Cc: zsh-users

On Sun, Oct 07, 2007 at 01:23:39PM +1000, Boyd Adamson wrote:
[...]
> % cd ~-<tab>
> directory stack
> 0 -- /export/home/boyd
> 1 -- /export/home
> 2 -- /opt
> 
> But I get the list in *reverse* order. What I'd really like is this completion:
> 
> % cd ~<tab>
> user
> adm       boyd      fred      listen    noaccess  nobody4   root
> student   uucp
> bin       daemon    gdm       lp        nobody    nuucp     smmsp
> sys       webservd
> 
> to include a section with the directory stack.
> 
> I have a feeling that this is a one-liner, but I've always found the
> zstyle system a bit bewildering.
[...]

Not an answer to your question, but personally, I do

$ cd +<Tab>

-- 
Stéphane


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

* Re: Completion of ~ to include dirstack?
  2007-10-07  3:23 Completion of ~ to include dirstack? Boyd Adamson
  2007-10-07  9:16 ` Stephane Chazelas
@ 2007-10-07 18:51 ` Bart Schaefer
  1 sibling, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2007-10-07 18:51 UTC (permalink / raw)
  To: zsh-users

On Oct 7,  1:23pm, Boyd Adamson wrote:
} Subject: Completion of ~ to include dirstack?
}
} What I'd really like is this completion:
} 
} % cd ~<tab>
} 
} to include a section with the directory stack.

Type ctrl-x h instead of tab and you'll see something like:

% cd ~
tags in context :completion::complete:-tilde-::
    users named-directories directory-stack  (_tilde) 
    users                                    (_users _tilde)

This indicates that tilde completion is already considering the
directory stack for inclusion.  Ordinarly you'd control what appears
in the listing with

    zstyle :completion::complete:-tilde-:: tag-order ...

and the order in which they appear with

    zstyle :completion::complete:-tilde-:: group-order ...

However, in this case the directory stack is being handled by the
_directory_stack completer, and that completer ignores strings that
do not match "[-+]*", so with just a bare tilde none of the stack
entries are considered candidates.

So the only way to get what you want is to rewrite _directory_stack,
or rewrite _tilde to call something else to get the stack entries.


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

end of thread, other threads:[~2007-10-08  0:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-07  3:23 Completion of ~ to include dirstack? Boyd Adamson
2007-10-07  9:16 ` Stephane Chazelas
2007-10-07 18:51 ` Bart Schaefer

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