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

Re: Can I put a newline in an alias?



On Jul 22,  4:42pm, Russell Hoover wrote:
> Subject: Re: Can I put a newline in an alias?
> > There isn't any special syntax for that.  You just have to put the control
> > characters in as themselves.
> 
> I'm not sure I understand.  I know  it would be very useful to be
> able to put into aliases things like: 
> 
> 1) a return at the end of the alias (so that I can type, say, a one-letter
> alias and have the command, or series of commands, executed without having
> to hit <return> after I type the alias.

This wouldn't work anyway.

Aliases aren't interpreted until command execution, which doesn't happen
until you hit return.  What you want is "bindkey -s".

> 2) a control sequence, like, say, <control-L>  I don't know what you would
> put in an alias to make a control sequence. What would be an example? What
> would one look like?

What it looks like would depend on what editor you were using.  If it's
the zsh line editor, it "looks" like ^L, but you type <ctrl-V><ctrl-L>
to insert one.  You can't type the two characters `^' and `L' and have
them be interpreted as <ctrl-L>.  The <ctrl-V> means "intepret the next
thing I type as simple input, even if it would otherwise be an editor
command."  That's what I mean by "put the characters in as themselves."

Characters entered in this way normally should be part of a quoted string.

> 3) what would be the representation of any control character -- <return> ,
> <tab>, <control-whatever>, <esc> -- how is any of these put into an alias?

Same way.

> Maybe if one wants to use such things that means it's time to start using
> small scripts.

Shell functions.

> i guess I'm looking for a sort of QuicKeys for zsh . . .

You definitely want "bindkey -s".



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