* Can I put a newline in an alias?
@ 1997-07-20 1:51 Russell Hoover
1997-07-20 4:02 ` Bart Schaefer
0 siblings, 1 reply; 6+ messages in thread
From: Russell Hoover @ 1997-07-20 1:51 UTC (permalink / raw)
To: Zsh-users
This is a pretty basic question, but i tried using \n and ^M to put a
newline, or carraige return, into an alias, and neither worked.
How is this done? Or is it? Also how can i put a 'control-whatever'
sequence into an alias? I'm using zsh 3.0.1.
--
// rusty@panix.com //
City cops & state cops & national guard & bureau cops & tv cops &
movie cops & uniform & plainclothes cops & riot cops & cops on top of
cops on top of cops on top of cops: it's a world full of cops. --Paleface
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Can I put a newline in an alias?
1997-07-20 1:51 Can I put a newline in an alias? Russell Hoover
@ 1997-07-20 4:02 ` Bart Schaefer
1997-07-20 15:41 ` Russell Hoover
0 siblings, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 1997-07-20 4:02 UTC (permalink / raw)
To: Russell Hoover, Zsh-users
On Jul 19, 9:51pm, Russell Hoover wrote:
} Subject: Can I put a newline in an alias?
}
} This is a pretty basic question, but i tried using \n and ^M to put a
} newline, or carraige return, into an alias, and neither worked.
}
} How is this done? Or is it? Also how can i put a 'control-whatever'
} sequence into an alias?
zsh% alias this_has_a_newline='echo this
quote> echo has a newline'
zsh% this_has_a_newline
this
has a newline
Same thing should work for any control sequence; just put it in quotes.
Notice that in the sample above the newline was taken as a command
separator. That's probably not what you mean, but since you didn't
say why you want to include a newline or control ...
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Can I put a newline in an alias?
1997-07-20 4:02 ` Bart Schaefer
@ 1997-07-20 15:41 ` Russell Hoover
1997-07-20 17:07 ` Bart Schaefer
0 siblings, 1 reply; 6+ messages in thread
From: Russell Hoover @ 1997-07-20 15:41 UTC (permalink / raw)
To: Zsh-users
On Sat 07/19/97 at 09:02 PM -0700, Bart Schaefer <schaefer@brasslantern.com> wrote:
> zsh% alias this_has_a_newline='echo this
> quote> echo has a newline'
> zsh% this_has_a_newline
> this
> has a newline
Thanks. This works fine -- all I wanted was to be able to do something like
hit 'c <return>' to clear the screen and have a filenames-only listing of
the current dir at the top of the screen.
> Same thing should work for any control sequence; just put it in quotes.
I was wondering more about what chars you'd use within an alias to represent
'control-'
> Notice that in the sample above the newline was taken as a command
> separator. That's probably not what you mean, but since you didn't
> say why you want to include a newline or control ...
Well, it serves the purpose. If there's a better way, I'd be glad to hear
that, too.
--
// rusty@panix.com //
Intelligent people laugh quickly and smile slowly.
-- Malcolm de Chazal Sens-Plastique
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Can I put a newline in an alias?
1997-07-20 15:41 ` Russell Hoover
@ 1997-07-20 17:07 ` Bart Schaefer
1997-07-22 20:42 ` Russell Hoover
0 siblings, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 1997-07-20 17:07 UTC (permalink / raw)
To: Russell Hoover, Zsh-users
On Jul 20, 11:41am, Russell Hoover wrote:
} Subject: Re: Can I put a newline in an alias?
}
} [...] all I wanted was to be able to do something like
} hit 'c <return>' to clear the screen and have a filenames-only listing of
} the current dir at the top of the screen.
function c() {
echotc cl
print -rc *(.)
}
} I was wondering more about what chars you'd use within an alias to represent
} 'control-'
There isn't any special syntax for that. You just have to put the control
characters in as themselves.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Can I put a newline in an alias?
1997-07-20 17:07 ` Bart Schaefer
@ 1997-07-22 20:42 ` Russell Hoover
1997-07-22 22:39 ` Bart Schaefer
0 siblings, 1 reply; 6+ messages in thread
From: Russell Hoover @ 1997-07-22 20:42 UTC (permalink / raw)
To: Zsh-users
On Sun 07/20/97 at 10:07 AM -0700, Bart Schaefer <schaefer@brasslantern.com> wrote:
> 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.
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?
3) what would be the representation of any control character -- <return> ,
<tab>, <control-whatever>, <esc> -- how is any of these put into an alias?
Maybe if one wants to use such things that means it's time to start using
small scripts.
i guess I'm looking for a sort of QuicKeys for zsh . . .
--
// rusty@panix.com //
A beautiful female body is the best kind of bed lamp.
Sleeping side by side makes the night less opaque.
-- Malcolm de Chazal Sens-Plastique
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Can I put a newline in an alias?
1997-07-22 20:42 ` Russell Hoover
@ 1997-07-22 22:39 ` Bart Schaefer
0 siblings, 0 replies; 6+ messages in thread
From: Bart Schaefer @ 1997-07-22 22:39 UTC (permalink / raw)
To: Russell Hoover; +Cc: Zsh-users
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".
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~1997-07-22 22:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-07-20 1:51 Can I put a newline in an alias? Russell Hoover
1997-07-20 4:02 ` Bart Schaefer
1997-07-20 15:41 ` Russell Hoover
1997-07-20 17:07 ` Bart Schaefer
1997-07-22 20:42 ` Russell Hoover
1997-07-22 22:39 ` 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).