zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Prompt formatting tricks for cut-and-paste
Date: Tue, 24 Aug 2010 08:07:44 -0700	[thread overview]
Message-ID: <100824080744.ZM27926@torch.brasslantern.com> (raw)
In-Reply-To: <AANLkTikuH91W+P4bWKTEVzW=gtBZQfPwDJQphKyy=mz1@mail.gmail.com>

On Aug 24,  3:48pm, Mikael Magnusson wrote:
}
} % zsh -f
} % autoload compinit
} % compinit -D
} % zmodload zsh/complist
} % bindkey '^F' menu-select
} % bindkey '^B' reverse-menu-complete
} 
} (btw, I just realized after a couple of years if you do 'alias %=' in
} the zsh -f you can paste things like these more easily).

That works if you use an extremely simple prompt that can be aliased.
You might want to use

    alias %=' '

so that the next word (the real command) is also alias-expanded.  Not so
important when testing with zsh -f ...

Another similar trick is to have your more complex prompt begin with ":"
and end with ";", so you get things that look like

: user@host; bindkey '^F' menu-select
: user@host; bindkey '^B' reverse-menu-complete

If you combine that with coloring or %B/%b so the prompt stands out,
there's little loss of readability.  You still have to avoid using
glob or redirect characters in the prompt (unless you also throw in
quotes, but then you're wasting 5+ characters on the trick).

Note you probably want to fix up at least PS2 in a similar way.


           reply	other threads:[~2010-08-24 15:07 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <AANLkTikuH91W+P4bWKTEVzW=gtBZQfPwDJQphKyy=mz1@mail.gmail.com>]

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=100824080744.ZM27926@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).