From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 064FC27D82 for ; Wed, 24 Jan 2024 14:57:24 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1706104644; b=aU8Y+85XgLtwh0A+lqMk/CTnjQy5ezx3Yi4zIElonP6KB4LMn5TcnVo+XAD6vgv+2y9EA9GKDX uIyi+LUG5lXqyraYlOZJ3/74HJFE6oSzhuX3cOYl4IMWtT0J3Ry8Xgja+GlihOQQrssQDCxV3u +CPL0vop6WuIuYRTg4oM4y9Oh6b7gqI/4almNWT3+vRhz6Zcq/IgFWMOfseljSkjmHUpJToYYo UlLGlnnXUfDq7ySo6BtcpT/nSCVAqRgeqeVywq4AeDVJ9zWSkPgPNGrlai8wv9/3sCpYwxmry+ 9JBwnSuOfhOKmRLSw5uuc/WkMYO9kQJDcPAwGsqvOGmVEg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lj1-f170.google.com) smtp.remote-ip=209.85.208.170; 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=1706104644; bh=fXbDM74p/Z0GwJiF7s86QWz7ZMS29F/BvBUGokF2u6s=; 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=DzOygmfONtbQRYNyjbyCkd4CCPdxcVmGUnIPkRXzM6bSpJic9XJoGHikh/r62e5OSHwgeo8QaZ yzZE85z05ZQrlxF+pyQsOV42NTj6OA88IsUN3ixZPpzgTi9Aum01YFy8p4hIdTuFPeiiidBn58 CSNnvPoIoThnNikASRsIM49fwU/YOiOioMsA6XfptUPTlmrOIawTVH4KE8g1cD8oCh578YA9Fw wBXtdSUTn+wUBTnLMN96i5R0eh8/eEd/dt/74Q2K6+eZc8iAWdeJbIFIRB6X25fXz3KWSbOWKM 7qHXCg/3ijYJEjJgBS6F68Ws8BDUgchdqT1BcalSnwvWOA==; 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=fXbDM74p/Z0GwJiF7s86QWz7ZMS29F/BvBUGokF2u6s=; b=Wi3KB4cNh1reuXbpq4e8+kR3qa 6x3ILo4+qEiBEzskTqz2rt+oA5EzgKGJAfkq9M2pmWwUUcy/y/XfpPatzOKMt6Yw+WV3RhQJ4AmQ+ am553mKnrKJjDr9MnJjjN1WkPJCmnIyX1V2Iggl1HBhiQrFnLJ+hGnU0xsEwnx9KOA/rJmBrgogiF 61T+EZintKaOi3J23Xd8taOGUqv102c/FncEzga/LC+yISDt907vNscILyEcV7ZGxfBWZVi2QSvC1 R0i5zmt5/nL5fh5LgG+W3rw0H5P+FJKEN2IlIzD/oKT3wdMfu5iIY8P3oV9mKbLnGE9/EmuGN426G UOdYgMiA==; Received: by zero.zsh.org with local id 1rSdkq-000DRP-5H; Wed, 24 Jan 2024 13:57:24 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lj1-f170.google.com) smtp.remote-ip=209.85.208.170; 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-f170.google.com ([209.85.208.170]:47436) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rSdi3-000Cce-Kh; Wed, 24 Jan 2024 13:54:32 +0000 Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2cf206e4d56so6681021fa.3 for ; Wed, 24 Jan 2024 05:54:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706104471; x=1706709271; 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=fXbDM74p/Z0GwJiF7s86QWz7ZMS29F/BvBUGokF2u6s=; b=EG9p5Brk5TjIGmEyZG38YW1JYBjLrB5qyvQFU3etyucpjPct0uwhtvCzTYBLbKh6wX h8aU21l3oe8uoRWCPV8OJoVgeNR6P590BDhAJdBEtsrBwEB4Q460zBiaYK+X3rN50fiV lheMcsh12atXow53iFVXEU3X+yuOWh7hFYvSlaiP8KIjW0Dlw7rGepsRbkva+TimCoIl s7FNm8Xf6eO9h7IC++e9Y2FmGX9wJ5zfM7eTbK2fNw4IYtwJekSJDrWwvB7xsq16vTq5 oLVbgcJT+u8QGZ1xEUgnr1MuYCxVrbuUH4qLXHiAIy/HgdzashluLFVvJ0tsvQds/hcv N1HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706104471; x=1706709271; 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=fXbDM74p/Z0GwJiF7s86QWz7ZMS29F/BvBUGokF2u6s=; b=UIcJlD69/ozawr7skVDqhfGb1pS3G8j8WVKnQORMNHt1oKunRofVbFx4kULy9TWMyW 8H+bXBODKRdRns1lRwBEU8++QDuL59kGY/OgA5KnwclsxB3uDY/DXIjjjSXPW0qddG8s Kq/4ZiOKbPf0AxZ6exD0XBQex7rv3ofYYLd/gVrTlm7a3nV2I4ZEMLvA1wockDKIqCrZ SpgTKbbGk+9+s4qeioCs5GSekGq//qCFFGQ1JObgns0z9baxg9fKIo+mMpnAqq1RMESw uEdNef/JG3jW2us3FGUyryZl1OHOQ9lz9j8Qg2CtEiazS0HNnDYxieQ82f6W8BSAiCJL L8MQ== X-Gm-Message-State: AOJu0Yx7pfBzU9a97ea8HkAFxRcrLNdYFj2Wg+cr4tGzXIo3uLKDqR9J 6o6paj/IvvKlsON5+Cqti73fvlJClm2S8ghSRray9Rg/7Gh+VXq9qvAf8D9rZRdg8PkqwVfuF/7 X+KQn6aoL7ro5zQg6ytTC8AdNxMg= X-Google-Smtp-Source: AGHT+IEmceVuTvSFZjeKwgNyTsHyuuezSR3PuWsSs9hrDISsHxzkpCRex6EMsfbimOoSDsc1LwlMtZlQEX8ooTCElA8= X-Received: by 2002:a2e:a482:0:b0:2cd:83b5:bd1c with SMTP id h2-20020a2ea482000000b002cd83b5bd1cmr511385lji.92.1706104470818; Wed, 24 Jan 2024 05:54:30 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Roman Perepelitsa Date: Wed, 24 Jan 2024 14:54:18 +0100 Message-ID: Subject: Re: Convert control characters to bindkey/quoted-insert -style escape sequences To: Marlon Richert Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 29555 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 Wed, Jan 24, 2024 at 2:36=E2=80=AFPM Marlon Richert wrote: > > I know I can convert control characters to $'...' -style escape sequences= using ${(qqqq)...} or ${(q+)...} expansion. > > However, how can I convert control characters to bindkey/quoted-insert -s= tyle escape sequences? > > For example, I want to convert a newline character to ^M and not $'\n' > > Basically, I want the inverse of a ${(g:c:)...} expansion. That thing with psvar that you described in another thread is ${(V)name}. It'll give you ^M (rather than \r) as you seem to want. You are still going to get \n instead of ^J and \t instead of ^I. It's pretty good in practice for what it is meant to do: make a string presentable to humans. It's not particularly consistent with the choice of C-escapes vs carets though. I don't know if there is a way to encode special characters exclusively through caret notation. This encoding is fairly simple, so you could also do it manually if you need to. Roman.