zsh-users
 help / color / mirror / code / Atom feed
* Zsh completion configuration with history-words as another group to _complete
@ 2013-02-26  6:09 joe M
  2013-02-26  7:23 ` joe M
  2013-02-26 16:26 ` Bart Schaefer
  0 siblings, 2 replies; 4+ messages in thread
From: joe M @ 2013-02-26  6:09 UTC (permalink / raw)
  To: zsh-users, zsh-workers

Hello,

I am trying to figure out how to add "history-words" as a group within
_complete, similar to aliases or functions.

zstyle -e ':completion:*' completer \
   'compprefuncs=(_history_word_list) reply=(_complete _match
_approximate _ignored _prefix)'

cat /usr/share/zshcat
/usr/share/zsh/5.0.2/functions/Completion/Base/_history_word_list
#autoload
_history "$@"
return 0/5.0.2/functions/Completion/Base/_history_word_list
#autoload
_history "$@"
return 0

The list of history-words show up along with any other groups shown by
_complete or any of the completers in "reply". But, unfortunately, it
does not execute the matched word with one Enter keypress. I need to
press Enter twice for the history word to be used.

I am not sure if the above is the correct approach to this issue, or,
if I should be looking at changing _complete to add the
_history_words_list as a tag within the  _complete function instead.

Any thoughts, please?

Thanks
Joe


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

* Re: Zsh completion configuration with history-words as another group to _complete
  2013-02-26  6:09 Zsh completion configuration with history-words as another group to _complete joe M
@ 2013-02-26  7:23 ` joe M
  2013-02-26 16:33   ` Bart Schaefer
  2013-02-26 16:26 ` Bart Schaefer
  1 sibling, 1 reply; 4+ messages in thread
From: joe M @ 2013-02-26  7:23 UTC (permalink / raw)
  To: zsh-users, zsh-workers

Hello,

> if I should be looking at changing _complete to add the
> _history_words_list as a tag within the  _complete function instead.

if I change /usr/share/zsh/5.0.2/functions/Completion/Zsh/_command_names,
by changing the below lines to:

defs=(
  'commands:external command:_path_commands'
)

to

defs=(
 'history:history words:_history_complete_word'
  'commands:external command:_path_commands'
)

It seems to work. Being a newbie, I am not sure if this is a reliable
approach. Any thoughts, please?

Thanks
Joe


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

* Re: Zsh completion configuration with history-words as another group to _complete
  2013-02-26  6:09 Zsh completion configuration with history-words as another group to _complete joe M
  2013-02-26  7:23 ` joe M
@ 2013-02-26 16:26 ` Bart Schaefer
  1 sibling, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2013-02-26 16:26 UTC (permalink / raw)
  To: zsh-users

On Feb 26,  1:09am, joe M wrote:
}
} zstyle -e ':completion:*' completer \
}    'compprefuncs=(_history_word_list) reply=(_complete _match
} _approximate _ignored _prefix)'

I'm now regretting having mentioned compprefuncs in that thread last
month.  Really, just don't mess with it unless you know exactly why
you need it.

} The list of history-words show up along with any other groups shown by
} _complete or any of the completers in "reply". But, unfortunately, it
} does not execute the matched word with one Enter keypress. I need to
} press Enter twice for the history word to be used.

That's probably because _history is adding so many matches that a menu
is always being invoked.

} I am not sure if the above is the correct approach to this issue

I think my previous response covers this ...

(BTW, zsh-workers see all zsh-users postings, no need to copy both lists.)


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

* Re: Zsh completion configuration with history-words as another group to _complete
  2013-02-26  7:23 ` joe M
@ 2013-02-26 16:33   ` Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2013-02-26 16:33 UTC (permalink / raw)
  To: zsh-users

On Feb 26,  2:23am, joe M wrote:
}
} if I change /usr/share/zsh/5.0.2/functions/Completion/Zsh/_command_names,
} It seems to work. Being a newbie, I am not sure if this is a reliable
} approach. Any thoughts, please?

As a general rule, if you (a) describe yourself as a newbie and (b) find
yourself re-hardwiring one of the default functions, you're probably on
the wrong track. :-)


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

end of thread, other threads:[~2013-02-26 16:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-26  6:09 Zsh completion configuration with history-words as another group to _complete joe M
2013-02-26  7:23 ` joe M
2013-02-26 16:33   ` Bart Schaefer
2013-02-26 16:26 ` 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).