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

Re: PATCH: suffix aliases



Peter wrote:
> This adds aliases for suffixes, so that after
> 
>   alias -s ps=gv
> 
> attempting to run a command called foo.ps will call `gv foo.ps'.
> 
> I could have used `alias .ps=gv' in the way 4DOS did, but as zsh aliases
> can be more or less anything it seemed more natural to have a completely
> separate table.

That makes sense.

Used to like that in 4DOS too myself. Was the only piece of shareware I
ever registered.

> I stuck with suffixes instead of patterns, which would have been less
> efficient and more complicated for little extra gain.

That's a pity. I have preexec testing for <-> and other combinations
like (#b)(<->).(<->) so that I can type numbers to get at MH messages.
I then need a few strategic alias 11='nocorrect 11' so that correction
doesn't offer me X11 or whatever as a correction. With pattern aliases,
back references could disable substituting the word as the last
argument which might have other uses such as commands which don't want
the file as the last argument (e.g. mozilla -remote).

>From the perspective of handling mime types and easier completion there
might be an argument for having both pattern and suffix completion.
Suffix completion could actually look for files, perhaps in it's own
path array and could allow the suffix to be omitted. So for wine
programs you wouldn't need to type the .exe and could put the program
directories in a suffix path.

> I dutifully added completion to _alias, but it seems that doesn't
> understand the difference between aliases with different options, so I

There isn't much point: completing existing aliases when defining new
ones isn't that useful anyway.

Oliver



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