zsh-users
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Jacob Menke <jmenke@wccnet.edu>
Cc: zsh-users@zsh.org
Subject: Re: Adding Global Aliases to completion lists
Date: Wed, 13 Mar 2019 14:15:13 +0000	[thread overview]
Message-ID: <20190313141513.hy6bw5lgc2jy3ttk@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <CAMgxA+cpR3=PRY0zRr_DTTE=rGXf2-_mQxhqv8Zez0L4bvXORw@mail.gmail.com>

Jacob Menke wrote on Tue, Mar 12, 2019 at 23:43:51 -0400:
> Hello I was wondering how to add global aliases to completion menu
> selection?

Like this:

diff --git a/Completion/Zsh/Type/_command_names b/Completion/Zsh/Type/_command_names
index f8188774d..70b0ddcad 100644
--- a/Completion/Zsh/Type/_command_names
+++ b/Completion/Zsh/Type/_command_names
@@ -29,6 +29,7 @@ else
     "functions:shell function:compadd -k 'functions$ffilt'"
     'aliases:alias:compadd -Qk aliases'
     'suffix-aliases:suffix alias:_suffix_alias_files'
+    'global-aliases:global alias:compadd -Qk galiases'
     'reserved-words:reserved word:compadd -Qk reswords'
     'jobs:: _jobs -t'
     'parameters:: _parameters -g "^*(readonly|association)*" -qS= -r "\n\t\- =[+"'

Note that an alias does not have to be global in order to be able to be used in
command position; that is: depending on what your alias does, it might be
better to simply remove the -g from its definition.

> This is the debugging output from ^Xh when I want to add these completion
> items.
> 
> tags in context :completion::complete:-command-::
>     commands builtins functions aliases suffix-aliases reserved-words jobs parameters parameters  (_command_names _autocd)

Thanks for including this; it made it easy to find the right function.

Cheers,

Daniel

      reply	other threads:[~2019-03-13 14:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-13  3:43 Jacob Menke
2019-03-13 14:15 ` Daniel Shahaf [this message]

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=20190313141513.hy6bw5lgc2jy3ttk@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=jmenke@wccnet.edu \
    --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).