zsh-users
 help / color / mirror / code / Atom feed
* substring version of history-complete-word?
@ 2002-07-04 11:45 Adam Spiers
  2002-07-05 19:37 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Adam Spiers @ 2002-07-04 11:45 UTC (permalink / raw)
  To: zsh users mailing list

Hi all,

Is there any way of performing completion of words from history based
on a substring rather than a prefix?  For example, if the word
`/usr/src/linux-2.4/Documentation/networking/netdevices.txt' is in the
history, I would like to be able to retrieve it by referring to it as
`Doc' or `2.4'.  Ideally, it would be retrievable incrementally in the
same way as C-r fetches whole lines.  Incidentally, as some of you may
have already guessed, the inspiration for this is iswitchb
buffer-switching in emacs.

Adam


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

* Re: substring version of history-complete-word?
  2002-07-04 11:45 substring version of history-complete-word? Adam Spiers
@ 2002-07-05 19:37 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2002-07-05 19:37 UTC (permalink / raw)
  To: Adam Spiers, zsh-users

On Jul 4, 12:45pm, Adam Spiers wrote:
}
} Is there any way of performing completion of words from history based
} on a substring rather than a prefix?

With the proper value of the matcher-list style, it should "just work."
E.g.:

schaefer<507> echo tec<ESC-/>
schaefer<507> echo aztec.zanshin.com

My particular settings cause words that match prefixes to be preferred
over words that match substrings:

schaefer<507> echo zan<ESC-/>
schaefer<507> echo zanshin@

Or:

schaefer<507> echo com<ESC-/>
Completing history word
compdump'  commit     compdump'  commit

(Hmm, I guess I don't have the remove-all-dups style set.)

} Ideally, it would be retrievable incrementally in the same way as C-r
} fetches whole lines.

I don't have a suggestion for how to do this except using incremental menu
selection (added to the CVS dev tree by Sven in zsh-workers/17366).

I haven't figured out how to set the matcher-list style specifically for
history completion, the above is all the result of my generic matchers.
There's some pretty strange code for styles in _history_complete_word:

        if [[ -z "$curcontext" ]]                                            
        then
                curcontext=history-words:::                       
        else
                curcontext="history-words${curcontext#*:}" 
        fi                                                        
	[...]
        zstyle -t ":completion:${curcontext}:history-words" stop && stop=yes 
        zstyle -T ":completion:${curcontext}:history-words" list || compstate[list]=''                                                   

(So we have styles that look like *:history-words:*:history-words ??  Is
that really intentional?)

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

end of thread, other threads:[~2002-07-05 19:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-04 11:45 substring version of history-complete-word? Adam Spiers
2002-07-05 19:37 ` 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).