zsh-users
 help / color / mirror / code / Atom feed
* Adding Global Aliases to completion lists
@ 2019-03-13  3:43 Jacob Menke
  2019-03-13 14:15 ` Daniel Shahaf
  0 siblings, 1 reply; 2+ messages in thread
From: Jacob Menke @ 2019-03-13  3:43 UTC (permalink / raw)
  To: zsh-users

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

Hello I was wondering how to add global aliases to completion menu
selection?  Regular aliases and suffix aliases are already present.  I am
separating the menu selection items by tags.

zstyle ':completion:*' group-name ''

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)
    commands
                      (_path_commands _command_names _autocd)
    jobs
                      (_jobs _command_names _autocd)
    parameters
                      (_parameters _command_names _autocd)
    local-directories named-directories
                       (_cd _autocd)
    users named-directories directory-stack
                       (_tilde _cd _autocd)

Thanks Jacob

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

* Re: Adding Global Aliases to completion lists
  2019-03-13  3:43 Adding Global Aliases to completion lists Jacob Menke
@ 2019-03-13 14:15 ` Daniel Shahaf
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Shahaf @ 2019-03-13 14:15 UTC (permalink / raw)
  To: Jacob Menke; +Cc: zsh-users

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

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

end of thread, other threads:[~2019-03-13 14:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-13  3:43 Adding Global Aliases to completion lists Jacob Menke
2019-03-13 14:15 ` Daniel Shahaf

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