Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Prompt formatting tricks for cut-and-paste



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.



Messages sorted by: Reverse Date, Date, Thread, Author