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

Re: ideas: free-search-complete, noexpand



On Aug 4,  8:49pm, Johan Sundström wrote:
> Subject: ideas: free-search-complete, noexpand
> 
> Wouldn't it be really nice if there was a completion mechanism that
> wasn't locked to complete from the beginning of your word only, but
> instead would find "mark_dirs" from a larger list of possible
> completions, given the string "dir"?

It's called "globcomplete":

zsh% setopt globcomplete automenu
zsh% setopt *dir*<TAB>
zsh% setopt autonamedirs<TAB>
zsh% setopt hashdirs<TAB>
zsh% setopt markdirs

> I'd love this one --- am I the only one who always seems to remember
> parts of filenames that aren't their first characters? :-/

Yup, you seem to want globcomplete.

> ...and how come there is a 'noglob' command, but no 'nohist', 'noexpand'

You can get nohist with `!"':

zsh% !" say Hi!!! It's been a while, now!

However, you can't do that in an alias.  In fact, none of this works for
history because history is expanded at lex time, and "noglob" et. al. are
recognized and aliases expanded at parse time.  The "history expansion"
during lexing of `!"' is what "quotes" the rest of the `!' on the line.

As far as I can tell, "noexpand" would be the same as single-quoting the
entire line (which in recent versions of zsh is also sufficient to stop
history from expanding), except for word breaking.  It is technically
feasible to create a precommand to do this, except for history, but there
is a similar shortcut already.  Have you tried using ESC-" or ESC-' at
all?  Those are bound to quote-region and quote-line, respectively.  For
example:

zsh% say "It's a pain in the *ss", he thought to himself.
         ^
         set mark here, then C-e ESC " and you get:

zsh% say '"It'\''s a pain in the *ss", he thought to himself.'



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