From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5966 invoked from network); 5 Jul 2000 14:11:02 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 5 Jul 2000 14:11:02 -0000 Received: (qmail 18079 invoked by alias); 5 Jul 2000 14:10:56 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 12174 Received: (qmail 18065 invoked from network); 5 Jul 2000 14:10:54 -0000 Message-ID: <396341C2.C823423F@u.genie.co.uk> Date: Wed, 05 Jul 2000 15:10:10 +0100 From: Oliver Kiddle X-Mailer: Mozilla 4.73 [en] (Win95; I) X-Accept-Language: en MIME-Version: 1.0 To: zsh-workers@sunsite.auc.dk Subject: completing history words Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I'm a little bit mystified by the way _history_complete_word is implemented as it seems to re-implement menu-completion while not offering non-menu completion. Why does it not just complete history words and rely on separate completers based on different builtin widgets (menu-complete, complete-word etc)? I wanted to be able to complete history in a fairly normal way but it behaves in a slightly strange way, doing things like inserting a match for ambiguous completions. I created a small function (_complete_history) containing just the line: compadd -Q -a 'historywords[2,-1]' Then, I defined three completion widgets based on it: zle -C history-complete complete-word _complete_history zle -C history-menu menu-complete _complete_history zle -C history-reverse-menu reverse-menu-complete _complete_history As far as I can tell, the latter two behave largely like _history_complete_older and _history_complete_newer. The first one provides roughly the behaviour which I wanted. I just needed a few key bindings and it was all working: bindkey '\e,' history-complete bindkey '\e.' history-menu bindkey '\e/' history-reverse-menu bindkey -M menuselect '\e,' complete-word bindkey -M menuselect '\e.' menu-complete bindkey -M menuselect '\e/' reverse-menu-complete It actually seems to have a problem with strange characters (e.g. '$') not being considered part of the word being completed but other than that, it is fine. Obviously, my _complete_history function could be much improved with styles for sorting and to manipulate compstate so listing etc can be turned off but this way of doing it seems better to me. It is much simpler and configuration of it will be more similar to configuring for other completion widgets. Can anyone please explain why it is currently done differently? Oliver