From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 9487 invoked from network); 13 Nov 2023 08:47:34 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 13 Nov 2023 08:47:34 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1699865254; b=gFmoXX9jA1Q2sRsYqX4GNVlitoWQHdL5VF+gxJWuQhzBwQlThYimDWzUeZEax+UASQEcbvRST1 t0cmtQr8TjJXTISfQgDnYR+DxspivyYhuktfUdiEsjh3F7QyFNy2zVtQGjSbVU15z6NQv2C65o 1cx4xqljlEj1xKynptN2yi6jvwGrMLaTxuVVqxsq0jyE+nRcd/7cv9gfz2cGAOqtQnxallesNF zmQfxpBbx0VuoR2JojGK9XZiMb8PmHVxIHujIJZ+BS13Gi82rLd5KuoX9G6/5I1DtbToDbAs9X DGxse2cvVNOoZf2iVO6PAIzwhelQLk+uXLQsxCnQW1Kcxw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lj1-f171.google.com) smtp.remote-ip=209.85.208.171; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1699865254; bh=a4CTm6aqv2E+PQlbU+L5vCFMXOqbWvD1wOeXoMehwog=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature: DKIM-Signature; b=ZxXwE83rjebDx+/5CBWS11/szMruItPqJYkthDttK5oooyc9uTJc6Jq+sTd1TfWw3LOjRR88ot q9Os9G8n1ZguS1/OzfVXo+0rNQ11rquIz8pRHwJruouu+uBV5Q4NDL5YvfZAf/FNmEpQeZ2yEo KcUKu/WHDX2PrQMbpdATK5SouIifXd5KmyWvkhIyUvqk9BzW4nv78BnmvtbN+Zqoa9x7ouWoN2 sWtfohXh6SLneYUe/Edvv42gSFqvg9JaEAc3MwGt/et5O2dtI/cvgM9skm21A516yOuVNM3I4h uiUJEHfLrIIJJS+vWSXrTkA0EB32UNsotilAwWI7m/DS0w==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=uO6Lx/2iultSe2kSo5YpNnMK+16BgHRrR7MzFtbFIrs=; b=GohmIzbMfahFhRoYjW5R06COxv QGDr2LxxqvdMt+WUzs5smAHunNo0vtMtvJOvohO8TeQIA8QmSF2pyKev3t8BYWPbjaAfq9QvLE5vw mGnB5DLij4iodtVfVUb8SlyMsx95/Mm5ysMp+1+GVAG0iuf4CEbXQpa1YYAEQPPEIf1EP1xc0IXT/ q2Rh1T82UhbrpCExwCBv2wo5NtpfJ2qrAtt7lw+hDIpROp+Ox5hnfjkoqE687oMcENNo4waSRHWoX z1OcrvHiMZ6gsY6KOYsE7X41xvLb3WesphRrdl856xTPI/T/MuAXyIdE5kN4e1M5PChHLGdHVlANw SnYD9qSw==; Received: by zero.zsh.org with local id 1r2SbV-0008e2-KR; Mon, 13 Nov 2023 08:47:33 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lj1-f171.google.com) smtp.remote-ip=209.85.208.171; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-lj1-f171.google.com ([209.85.208.171]:48595) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1r2SaM-0007um-Rn; Mon, 13 Nov 2023 08:46:23 +0000 Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2c742186a3bso51376101fa.1 for ; Mon, 13 Nov 2023 00:46:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699865182; x=1700469982; darn=zsh.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=uO6Lx/2iultSe2kSo5YpNnMK+16BgHRrR7MzFtbFIrs=; b=lNP40PyyXexCWRuHPG3XygYZ6rqLufldD+PDKRtj5sIHEdr7fOOL6MPbSpluNrRJNL zEB36dPrvB/re9UvGTsLqVWL+S7ygtB0IsvDmmaggnhCKCGULX5E9C2bcPeF7HxLp3d+ 2cpqmf3WV8NIdTK6kZ4DasHeyDEB8yTWZOn3t4tLYGxygTN1TK2Wc7XFjaOhJ3YzWZVp 2INyY4EkJgUvTTeomQWOtSGfFtarfLwXxO8YjXk6dffIMmtddm+hOt4WDle2kPIo4pm7 Hx/KR2OCye/Vmo0EmXu1W+u9HfeiaIGLMXRGockCbMB9DdcT4EaT5+IQXL8xWaBF3qyI P3ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699865182; x=1700469982; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uO6Lx/2iultSe2kSo5YpNnMK+16BgHRrR7MzFtbFIrs=; b=s4imSrB936ZISbV7Mt+vwKQJX9r/wRGijIHE4gKjiMWRNUbtoQUxjd6joUpkRuP88m et7V8udsO6J/segU0MWq5PIymlKFUjxTJxSX7RJRPLOxTKwgnFVXCrWbqJEKXcdvGv8u xzObVqcAGg5tDfEmQ4gp9VCQlAsjgP2kqfhFEGHFsSNWaP9P5yTT4bXT95FnisErrRRJ uG8Vf2JJYt3fzyfhO7oWnOhDLXaZ4mP842tqseKcAGIk9/gdhgBcanxIeQzxzIHu7xHR T98lQCNVOBMccwd80dnOLpJNe8C0KLhW/DaeklqLZmAhscBA+4LhtgH42IpwmeE/ZlmD P2+A== X-Gm-Message-State: AOJu0Yx94F7LXTaMN6kkmuQSRcKF22Qt8sB0KXYaqhwJ4OzP+XglQljc ZRKPZtve9Zh3ZPBaEno/h7GX/wjJIKnYkEZqBZyypEQgG9HC9A== X-Google-Smtp-Source: AGHT+IHje1MZgaRNGtJ/IGsQ2zw9jQx+bi0dSYNVZromyh2Xybv+PLrdvAMXJPRompDBo3QXhGLel5VO6OE8+/08QQ8= X-Received: by 2002:a2e:7015:0:b0:2c7:2e27:5b46 with SMTP id l21-20020a2e7015000000b002c72e275b46mr3811559ljc.37.1699865181745; Mon, 13 Nov 2023 00:46:21 -0800 (PST) MIME-Version: 1.0 References: <62a2cdc2fd719355bb6d0e5231d04258@chazelas.org> In-Reply-To: <62a2cdc2fd719355bb6d0e5231d04258@chazelas.org> From: Roman Perepelitsa Date: Mon, 13 Nov 2023 09:46:10 +0100 Message-ID: Subject: Re: zsh-no-ps2: A plugin that inserts a newline on Enter instead of displaying PS2 To: Stephane Chazelas Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 29356 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On Mon, Nov 13, 2023 at 8:29=E2=80=AFAM Stephane Chazelas wrote: > > On 2023-11-12 13:48, Roman Perepelitsa wrote: > > tl;dr: zsh-no-ps2 changes the behavior of Enter key to insert a > > newline instead of going into PS2 > [...] > > I remember offering something similar at > https://unix.stackexchange.com/questions/750378/disabling-the-secondary-p= rompt-in-zsh/750481#750481 > not so long ago (you might want to offer your plugin as an alternative > answer there). Thanks for the link. I've posted my own answer there. There are two differences in my code compared to yours. Firstly, my code looks at $PREBUFFER$BUFFER rather than just $BUFFER. This makes a difference if you end up in PS2 for some reason, perhaps intentionally. I think it's worth editing your answer to fix this. Secondly, my code works as expected when the buffer is "for x" or "< > The drawback to skipping PS2 is that you don't get the helpful hints > > about where you are in the syntax tree (by having %_ in the value of > > PS2 or RPS2), but as Roman notes in his README.md, you can get back to > > that by forcing an accept-line. > > Another widget that returns the state of the parser after reading what's > left of the cursor? Or perhaps something more generic: an actual parser, which gives you an AST. This would do all the heavy lifting required for implementing a syntax highlighter and a multitude of other features. Roman.