Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: brace in alias name and compsys



On Dec 15,  2:36am, Phil Pennock wrote:
}
} Given this:
} 
}     % alias ztrace{='() { setopt localoptions xtrace; '
} 
} However, tab-completing 'ztrace{' yields 'ztrace\{'.

This is coming directly from "compadd -k aliases" which in turn is
hardwired in the "defs" array in _command_names.

There's a similar problem with e.g. completing the builtin "!" "command".
It always gets turned into "\!" instead.

Can anyone think of a situation in which the following is wrong?

diff --git a/Completion/Zsh/Type/_command_names b/Completion/Zsh/Type/_command_names
index 24933c2..d9fc62d 100644
--- a/Completion/Zsh/Type/_command_names
+++ b/Completion/Zsh/Type/_command_names
@@ -27,11 +27,11 @@ else
   [[ "$1" = - ]] && shift
 
   defs=( "$defs[@]"
-    'builtins:builtin command:compadd -k builtins'
+    'builtins:builtin command:compadd -Qk builtins'
     "functions:shell function:compadd -k 'functions$ffilt'"
-    'aliases:alias:compadd -k aliases'
+    'aliases:alias:compadd -Qk aliases'
     'suffix-aliases:suffix alias:_suffix_alias_files'
-    'reserved-words:reserved word:compadd -k reswords'
+    'reserved-words:reserved word:compadd -Qk reswords'
     'jobs:: _jobs -t'
     'parameters:: _parameters -g "^*readonly*" -qS= -r "\n\t\- =["'
   )


While we're on the subject, completing after "[" or "[[" in command
position (no intervening whitespace) incorrectly attempts subscript
completion.  This appears to be a bug somewhere in the internals,
because compstate[context] has been set to 'subscript' and there's no
assignment to that in _complete_debug output.

Aside:  Zsh is unique, I think, in allowing alias names to contain
characters that are not legal in identifiers.



Messages sorted by: Reverse Date, Date, Thread, Author