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,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 31963 invoked from network); 21 Mar 2022 18:49:57 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 21 Mar 2022 18:49:57 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1647888597; b=k1N0uGmorN8ecGnLCSjKyzkjhNvpsM0IBeTWyUQfsR6gLhDlUOsiyAMs1dpQ6jh1j61EYi3sc7 Sz+j2SqaREDD542sZQLvkCE5PUNpXa7LoXMnpNsshp3OSs/W+lkxpStgID+StiZRB++Vx/E7X/ GMxwTxMxtMR5d/HLeV867AnCEBAkhDZZdR25Y+qSWLWcd3lVqUBOXBtQ6Dll25lpo7cJJJ0FTy DjnbFChQR4VwFWrtZWwSdm/E02xrVxDYq6jyEKF0Owsv57PBPTdjdyvaDC8902hrIsphiE6Ei2 Az/h4jKpvqRAubeOKYpaGtXbjrWxZ86pnGwZ2VagSwXlHg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-pl1-f170.google.com) smtp.remote-ip=209.85.214.170; dkim=pass header.d=gmail.com header.s=20210112 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=1647888597; bh=SacAGc1/JMqMgoRFwVT7/wDCU/G/hlwbVx8MozMTNzk=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:References: In-Reply-To:MIME-Version:DKIM-Signature:DKIM-Signature; b=NTo+A8L3EJ2RyyoOSRMywMZHUBPGn+6/vqFd3xH8AmXcBog2Qt9FsM6GKTH/CYagdTVd1e4z7/ +f7GjeTBm/W4TfwB5aazIItra3mu7/NyQOBOmQp178+k91CmiRTAVdNHmawq/IBagXoo8xoeXg brQY59uFattL4uhjUWdvvQUzwJOnGAm/PL3kmgdztdHRKD+1l4iiRnQ2L1XjHNutctK1/W+LQw ESQzGAxh45E/iqcB0TTRQpFjAE9SlZFrl3fHf0vudjqUJiGfHc+FoS7KWo4rQmvL5sWwnnrCE2 z/Q/WzhXDGvgc0OcSiVdlXpzrPcVXmg9CUe6BEy584Jf9A==; 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-Type:Cc:To:Subject:Message-ID :Date:From:References:In-Reply-To:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=RauIvSiuLi/5RHKzJkq82iBs1XpIeE7Gr2qXyWorVOo=; b=TRjYMAvPtaRG9vx38cid8T2DmY hBLrNmXis87ShYTf4XctFjvrB4n2dXsZVjrhZNcnmyFTvNUOFZ8ODzzsRKDkojOo2Uf0JJhEGawvT mSkpik3PWCM4WxHILwbpDpI3c+BjKSC7pzMzJ+abWEIBqBzSapHn7B/h4JtmyBrvCUk3+g1ZtBg5C lUSyHE75hABw/vg7JrSO0GOlVw4LJ1wnx8JutHyeCMdrmplZau7rryB9+8iUry+AX8rl5+QCjmlJ9 EOe00JXv3HeMDRpQABi7B2FWcYnltK+2vdUI3pNFg4qyyMzkC1dKKHLalLAROyGba0gFPI4L1L9nk f+8cku9w==; Received: from authenticated user by zero.zsh.org with local id 1nWN6L-000MN6-1i; Mon, 21 Mar 2022 18:49:57 +0000 Authentication-Results: zsh.org; iprev=pass (mail-pl1-f170.google.com) smtp.remote-ip=209.85.214.170; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-pl1-f170.google.com ([209.85.214.170]:39618) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1nWMJB-000JOW-6i; Mon, 21 Mar 2022 17:59:09 +0000 Received: by mail-pl1-f170.google.com with SMTP id d18so13422661plr.6 for ; Mon, 21 Mar 2022 10:59:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=RauIvSiuLi/5RHKzJkq82iBs1XpIeE7Gr2qXyWorVOo=; b=BHSd9V4643BkV961bGsJc/u8Wnei2eQAmYH3F6UyQx2HcNyCPlC3QBLYCEgpGSESzN Rtn2SBhGIK/jMKxJhmPWIi8areV4cI+k1mRpGmQzbjhetQD9wP7tB8yzO/GwC8plS7kq hqctPeivG17BsaA8Gk0yClwO7uiWsxijGdr4iIiB29gxeHJy+iZ9p55fvwfmR/p2oK/5 +C1d1T12sYYkMhBf1HTJKVYHCvUwbJr+ZqHWZVczXo0vlMivNPC9fndABgP+VGHY7N7o Fu8ePe5KP4VsfFQ9OPjJwMIfSF5TukzyGxdRp1vELnyRXI7bYKMI7IPzANBDX+qAgccO zPmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=RauIvSiuLi/5RHKzJkq82iBs1XpIeE7Gr2qXyWorVOo=; b=ctpL1xIgFPJ5PYWo84sWu2IwIO6nLwayLmAzXFd3V5HvEsqkcD1K8OT6nnBRVV/4dW PMfS4BztzCaxMIMj40wlu0StMQkSoRCAbDCuumHnt66Vq8wtRct36QIbS4oUw1cVOFAb 8ocG/Q05DvwnokWj1GgaaS3BLkP2grrg0Ym2es5u3nwPqtKIlPGIHa42HU3ZqXKy57Tu hsq9xwb9pLCJWgJOFornKzLFu9Sz3VzQRYNr/rGnwW7tcfhl2hyB+CxiMdGNlnY/5ifE vHfQo/oEm5SdNHehuxuMtwuIHOgn5s6ej/BNQP/KVV+39KFz5AZnfd9Nmv+ngW6TioWf s9mQ== X-Gm-Message-State: AOAM533ia2mkV38typiXYL64BcPsh90YrVLzIVW/zmxXP+SDc58BGpiM fRSTO2VCAqkJuAd1fEuLSLcCHx2fHsL0SPvfPD0= X-Google-Smtp-Source: ABdhPJwogONYRCloK4+yfssJos8vSQCP4lPWVfP+5HmLmGF05J/8/UTEgMVD3U/TFgK59iEofA2yjMwDHHtkxQN6YAY= X-Received: by 2002:a17:90a:cce:b0:1bf:6387:30d9 with SMTP id 14-20020a17090a0cce00b001bf638730d9mr333756pjt.196.1647885547838; Mon, 21 Mar 2022 10:59:07 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:6a10:466:0:0:0:0 with HTTP; Mon, 21 Mar 2022 10:59:07 -0700 (PDT) In-Reply-To: <20220321174741.GB1727@debian64> References: <20220321160650.GA1727@debian64> <20220321174741.GB1727@debian64> From: Mikael Magnusson Date: Mon, 21 Mar 2022 18:59:07 +0100 Message-ID: Subject: Re: Hi, can someone help me to convert my bash PS1 to zsh? To: Frank Schwidom Cc: zsh-users@zsh.org Content-Type: text/plain; charset="UTF-8" X-Seq: 27592 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 3/21/22, Frank Schwidom wrote: > On 2022-03-21 17:57:41, Mikael Magnusson wrote: >> On 3/21/22, Frank Schwidom wrote: >> > And here it is: >> > >> > (ins)$ echo "$PS1" >> > \[\]\u@\h \D{%Y-%m-%d %H:%M:%S}:\n\[\]\w\n\[\]\$\[\] >> > >> > (ins)$ set | grep '^PS1=' >> > PS1=$'\\[\E[32m\\]\\u@\\h \\D{%Y-%m-%d >> > %H:%M:%S}:\\n\\[\E[33m\\]\\w\\n\\[\E[35m\\]\\$\\[\E[0m\\] ' >> >> The manpage lists all the codes for zsh, which start with %. If you >> don't want to scroll down that much, you can also interactively type >> PS1=% and then hit tab for an abbreviated list. (the format inside >> %D{} is likely to be the exact same) >> >> Separately from that, you'll want to remove any \e[32m stuff and >> instead use %F{red} to start a color and %f to end (eg the 0m). If you >> use hardcoded escape sequences, you have to write %{ %} around them, >> or your cursor will end up in funny places, but there is no reason to >> do so for the codes you use. >> >> For example you might have, PS1='%F{blue}%n@%m %D{%Y-%m}%f' etc. (I >> don't know what the remaining bash codes correspond to). >> >> -- >> Mikael Magnusson >> > > I want to create a multiline prompt. I am missing the code for carriage > return or newline. > > In bash my Prompt looks like: > > user@computer 2022-03-21 18:43:18: > ~ > (ins)$ > > This '(ins)' comes from readline in vi mode and tells me in which state I > am. > > How can I create a newline in PS1? Just enter a newline, eg PS1=' ' will give you a prompt with a newline in it. As for vi mode (I don't use it myself) you probably want to check out http://bewatermyfriend.org/media/vi-mode.zsh -- Mikael Magnusson