zsh-users
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Perry Smith <pedz@easesoftware.com>
Cc: Danh Doan <congdanhqx@gmail.com>, zsh-users <zsh-users@zsh.org>
Subject: Re: Change interactive command into a comment
Date: Thu, 14 Nov 2019 15:40:13 +0000	[thread overview]
Message-ID: <20191114154013.z2x5ot3sndadepbh@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <91E3129F-1C3C-46FD-BAD9-3FF5F073455D@easesoftware.com>

Perry Smith wrote on Thu, Nov 14, 2019 at 07:19:01 -0600:
> 
> 
> > On Nov 13, 2019, at 10:41 PM, Danh Doan <congdanhqx@gmail.com> wrote:
> > 
> > On 2019-11-13 12:34:35 -0600, Perry Smith wrote:
> >> With bash, I got into the following habit.  If I started typing
> >> a long command and then decided I didn’t want to execute it right
> >> now for some reason, I would hit control-A to get back to the start
> >> of the line and then add a # in front and hit return.
> >> 
> >> This would put the command into history and so later I could recall
> >> it, remove the #, and execute the command.
> > 
> > Not an answer for your question, but this piece of code from grml zsh
> > config may interest you:
> > 
> > -------8<-----------------------
> > 
> > # add a command line to the shells history without executing it
> > commit-to-history () {
> > 	print -s ${(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.
> 
> Cool!  Thanks.

Shouldn't it be «print -rs -- ${(z)BUFFER}»?

  reply	other threads:[~2019-11-14 15:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-13 18:34 Perry Smith
2019-11-14  1:15 ` Ben Klein
2019-11-14  4:41 ` Danh Doan
2019-11-14 13:19   ` Perry Smith
2019-11-14 15:40     ` Daniel Shahaf [this message]
2019-11-14 15:56       ` Danh Doan
2019-11-14 22:21   ` Oliver Kiddle
2019-11-15 12:09 ` zzapper
2019-11-15 13:15   ` Perry Smith

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=20191114154013.z2x5ot3sndadepbh@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=congdanhqx@gmail.com \
    --cc=pedz@easesoftware.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).