Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Change interactive command into a comment
- X-seq: zsh-users 24436
- From: Danh Doan <congdanhqx@xxxxxxxxx>
- To: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- Subject: Re: Change interactive command into a comment
- Date: Thu, 14 Nov 2019 22:56:17 +0700
- Cc: Perry Smith <pedz@xxxxxxxxxxxxxxxx>, zsh-users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=sv8QzjjEaW33ZZa8tdfuM6FnHCZIJ2qktlbfTXiKUng=; b=YV8mcjwPejbERM3nh44WbMqZIYw9LpMvE3WToCJ0DjXwcKgk4/k1IUo2LWOPCZc5+Q Xk7wDKnsx2ShUeVdCVPH9FJCHaqHlslExgrZM32K68HH5mLBkUmqr4c8ENUlbAjVC4SU q6Pb0z9j2X1KZ2m2ICcJxhgyQq4GnUtueudREA1T/RBlGBkeFJQgwut93may2nahgjCO zjhvU52fpBDP0vMJTci9/65Mrs6Gcat1zmkODxafKyNl009FmoURVsLz54GxESHStQr8 Gsx++6tYnuMuBvfIJZV1KWdGvzyWTJYWE7KCw9jdKt6la8uJfzr2LgERoL+NLt9Fe6j9 U3OQ==
- In-reply-to: <20191114154013.z2x5ot3sndadepbh@tarpaulin.shahaf.local2>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <AE14DF7F-5C34-4D14-A20A-8356C547E114@easesoftware.com> <20191114044120.GA7796@danh.dev> <91E3129F-1C3C-46FD-BAD9-3FF5F073455D@easesoftware.com> <20191114154013.z2x5ot3sndadepbh@tarpaulin.shahaf.local2>
On 2019-11-14 15:40:13+0000, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
-------8<-----------------------
# add a command line to the shells history without executing it
commit-to-history () {
print -rs ${(z)BUFFER}
zle send-break
}
zle -N commit-to-history
bindkey -M viins "^x^h" commit-to-history
bindkey -M emacs "^x^h" commit-to-history
-------8<------------------------
> > >
> > > With this piece of code in your zshrc, you could press C-x C-h to
> > > commit your current command to history without executing it.
>
> Shouldn't it be «print -rs -- ${(z)BUFFER}»?
Yes, that's right, without `-r', escaped character will be evaluated.
Thanks.
--
Danh
Messages sorted by:
Reverse Date,
Date,
Thread,
Author