zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: _gnu_generic for aliases
Date: Wed, 1 Jun 2016 22:30:30 -0700	[thread overview]
Message-ID: <160601223030.ZM14495@torch.brasslantern.com> (raw)
In-Reply-To: <573D7E67.10600@mathphys.fsk.uni-heidelberg.de>

On May 19, 10:50am, Paul Seyfert wrote:
}
} I crosschecked that also
} 
}        compdef _gnu_generic fancyalias
} 
} does not result in any suggestions. My understanding is that the
} _gnu_generic function does not know about the fancyalias / I cannot use
} the fancyalias inside the _gnu_generic function.
} 
} Is there a way to make _gnu_generic work for aliases?

Have you tried "setopt complete_aliases" ?

Unfortunately it's not easily possible to have it both ways, that is, to
treat an alias as something you can "compdef" and ALSO have the alias be
expanded to use the completion for the command it eventually becomes.

This might work a lot of the time:

setopt complete_aliases
_expand_alias_and_complete() {
  if [[ -o complete_aliases && -n $aliases[$words[1]] ]]; then
    words[1]=( $aliases[$words[1]] )
    _complete
  else
    return 1
  fi
}
zstyle ':completion:*' completer _complete __expand_alias_and_complete

Needs tweaking based on the rest of your current "completer" style, but
hopefully you get the idea.


  reply	other threads:[~2016-06-02  5:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-19  8:50 Paul Seyfert
2016-06-02  5:30 ` Bart Schaefer [this message]
2016-06-02 10:20   ` [solved] " Paul Seyfert
2016-06-03  8: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=160601223030.ZM14495@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).