zsh-users
 help / color / mirror / code / Atom feed
* command completion
@ 2011-08-14 20:59 Vincent Lefevre
  2011-08-14 21:09 ` Mikael Magnusson
  2011-08-14 22:14 ` Bart Schaefer
  0 siblings, 2 replies; 11+ messages in thread
From: Vincent Lefevre @ 2011-08-14 20:59 UTC (permalink / raw)
  To: zsh-users

I asked a question several years ago about command/function/etc.
completion, but never had an answer. I'd like command completion
to be preferred over directory completion.

For instance, if I create an executable file blah-cmd and a directory
blah-dir in the current directory ("." being in the $PATH), and do:

% rehash
% zstyle ':completion:*:complete:-command-:*' tag-order 'commands'
% bl[TAB]

then I can see that various commands are proposed, but not blah-cmd.

^Xh (_complete_help) at this point outputs:

tags in context :completion::complete:-command-::
    commands executables builtins functions aliases suffix-aliases reserved-words jobs parameters  (_alternative _command_names _autocd (eval)) 
    commands                                                                                       (_path_commands _alternative _command_names _autocd (eval)) 
    jobs                                                                                           (_jobs _alternative _command_names _autocd (eval)) 
    parameters                                                                                     (_parameters _alternative _command_names _autocd (eval))

Unfortunately not all the tags are described in the zshcompsys
man page, and the description is quite short, so that I don't
understand why blah-cmd hasn't been proposed.

Then I've tried:

% zstyle ':completion:*:complete:-command-:*' tag-order 'executables'

but then both blah-cmd and blah-dir/ are proposed.

Now, if I move blah-cmd somewhere else in $PATH, and use

% zstyle ':completion:*:complete:-command-:*' tag-order 'commands'
% blah[TAB]

then only blah-cmd is proposed, as expected. However if I do:

% mkdir ~/blah-hdir
% cdpath=(. ~)
% setopt AUTO_CD
% blah[TAB]

then both blah-cmd and blah-hdir/ are proposed. I don't see why
blah-hdir/ should be regarded as a command.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)


^ permalink raw reply	[flat|nested] 11+ messages in thread
* Command Completion
@ 2012-09-11 12:55 Nick Cross
  2012-09-11 14:15 ` Bart Schaefer
  0 siblings, 1 reply; 11+ messages in thread
From: Nick Cross @ 2012-09-11 12:55 UTC (permalink / raw)
  To: zsh-users


Hi,

Would anyone be able to help with fixing a completion script? Or would 
the IRC channel be better>

The https://github.com/defunkt/hub project provides extra functions to 
git and supplies the following completion script:

https://github.com/defunkt/hub/blob/master/etc/hub.zsh_completion

Ideally I would like to use the hub binary command to complete standard 
git commands plus the extra commands it provides (e.g. pull-request). 
While I can see how to write a basic completion for a command what I'm 
not sure about is how to include and add to another completion set.

Thanks!

Nick



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

end of thread, other threads:[~2012-09-11 14:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-14 20:59 command completion Vincent Lefevre
2011-08-14 21:09 ` Mikael Magnusson
2011-08-14 21:54   ` Vincent Lefevre
2011-08-14 22:14 ` Bart Schaefer
2011-08-14 23:07   ` Vincent Lefevre
2011-08-14 23:56     ` Bart Schaefer
2011-08-15  0:57       ` Vincent Lefevre
2011-08-15  4:13         ` Bart Schaefer
2011-08-15  9:18           ` Vincent Lefevre
2012-09-11 12:55 Command Completion Nick Cross
2012-09-11 14:15 ` Bart Schaefer

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