Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RE: zsh-no-ps2: A plugin that inserts a newline on Enter instead of displaying PS2
- X-seq: zsh-users 29352
- From: zeurkous@xxxxxxxxxxxxxxx
- To: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>, Zsh Users <zsh-users@xxxxxxx>
- Subject: RE: zsh-no-ps2: A plugin that inserts a newline on Enter instead of displaying PS2
- Date: Sun, 12 Nov 2023 14:00:43 +0000 (UTC)
- Archived-at: <https://zsh.org/users/29352>
- In-reply-to: <CAN=4vMqm22rFLZnhM=7ytKr4wG14hQGGE3u6m1-cgkUAXCNvsg@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <CAN=4vMqm22rFLZnhM=7ytKr4wG14hQGGE3u6m1-cgkUAXCNvsg@mail.gmail.com>
Haai,
On Sun, 12 Nov 2023 14:48:22 +0100, Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx> wrote:
> tl;dr: zsh-no-ps2 changes the behavior of Enter key to insert a
> newline instead of going into PS2
>
> git clone https://github.com/romkatv/zsh-no-ps2.git ~/zsh-no-ps2
> source ~/zsh-no-ps2/zsh-no-ps2.plugin.zsh
>
> Normally, when you press Enter in zsh, one of two things happens:
Might be worth noting that this is also the case with 'Return', which,
confusingly, produces a carriage return. ('Enter' does only do so by
later convention; the latter really means "submit data for immediate
processing", which is a different operation on mainframes).
> if
> the currently typed command is complete, zsh attempts to execute it;
> if it's incomplete, zsh displays the secondary prompt, also known as
> PS2, to invite you to continue typing the command. I hate when zsh
> goes into PS2 because to fix the command most of the time I need to
> *edit what I've already typed*, which cannot be done.
Interrupt, then recall the command from the history buffer. It's a
workaround, but it works :)
> Those of you who
> are using zsh4humans have been able to change this behavior so that
> Enter inserts a newline if the typed command is incomplete. I've just
> created a standalone plugin to make this feature available to
> everybody: https://github.com/romkatv/zsh-no-ps2. No more PS2!
An alternative is to define an external editor (grep for
'edit-command-line' in zshcontrib(1)), which will be available during
PS2 as well.
HTH,
--zeurkous.
--
Friggin' Machines!
Messages sorted by:
Reverse Date,
Date,
Thread,
Author