zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: completer that first expands global aliases  (Re: dsf)
Date: Tue, 08 Jan 2013 20:40:25 -0800	[thread overview]
Message-ID: <130108204025.ZM4816@torch.brasslantern.com> (raw)
In-Reply-To: <kci341$vi7$1@ger.gmane.org>

On Jan 8,  9:29pm, Daniel wrote:
} Subject: Re: completer that first expands global aliases  (Re: dsf)
}
} >     zstyle -e ':completion:most-recent-*::::' completer \
} > 	'compprefuncs=(_expand_alias) reply=(_menu _complete _match)'
} 
} Ah, I understand how this is supposed to work; both your examples. Though,
} neither of them does work. I have to press ^Xm twice, first to expand my DL,
} and a second time to get a first file match.

I think you're never going to get precisely the behavior you want, because
aliases have to be entire words.  For example, if without using completion
at all you gave the command

	ls DL*

the DL would not expand, so you would not see a listing of the files in
the ~/dl/ directory.  Completion is going to have the same issue; the
alias has to expand as a word of its own before zsh can discover that it
is a directory that can contain files to match.

I think what you really want is a named directory, although you still
have to type a leading tilde and trailing slash (e.g. ~DL/) to refer to
files within one.  With a named directory, completion should "just work"
without having to first expand the abbreviation to the path to which it
refers.

    % hash -d DL=~/dl
    % ls ~DL/<TAB>

Of course if your directory is really named "dl" that's not saving you
very much.

If that won't do, then the way to get the closest to what you want is
to write a widget that modifies the words array and updates $PREFIX
before calling the _main_complete function.  You may be able to do this
by cribbing from _expand_alias.


  reply	other threads:[~2013-01-09  4:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-07 10:01 dsf Daniel
2013-01-08  9:41 ` completer that first expands global aliases (Re: dsf) Daniel
2013-01-08  9:58   ` Peter Stephenson
2013-01-08 13:06   ` Oliver Kiddle
2013-01-08 17:01     ` Daniel
2013-01-08 18:24       ` Bart Schaefer
2013-01-08 21:29         ` Daniel
2013-01-09  4:40           ` Bart Schaefer [this message]
2013-01-09  7:29             ` Daniel
2013-01-09 16:05               ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=130108204025.ZM4816@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).