zsh-users
 help / color / mirror / code / Atom feed
From: zeurkous@blaatscaahp.org
To: Roman Perepelitsa <roman.perepelitsa@gmail.com>,
	Zsh Users <zsh-users@zsh.org>
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)	[thread overview]
Message-ID: <thinkcrap!zeurkous!1699797641.2187@uucp.> (raw)
In-Reply-To: <CAN=4vMqm22rFLZnhM=7ytKr4wG14hQGGE3u6m1-cgkUAXCNvsg@mail.gmail.com>

Haai,

On Sun, 12 Nov 2023 14:48:22 +0100, Roman Perepelitsa <roman.perepelitsa@gmail.com> 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!


  reply	other threads:[~2023-11-12 14:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-12 13:48 Roman Perepelitsa
2023-11-12 14:00 ` zeurkous [this message]
     [not found] ` <6550dda9.170a0220.4fe72.dd3bSMTPIN_ADDED_BROKEN@mx.google.com>
2023-11-12 18:59   ` Bart Schaefer
2023-11-12 19:18     ` zeurkous
2023-11-13 14:20     ` Michal Politowski
2023-11-13  7:29 ` Stephane Chazelas
2023-11-13  8:46   ` Roman Perepelitsa
2023-11-14  2:10     ` Bart Schaefer
2023-11-14  1:38   ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='thinkcrap'\!'zeurkous'\!'1699797641.2187@uucp.' \
    --to=zeurkous@blaatscaahp.org \
    --cc=roman.perepelitsa@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).