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

Re: using ^M to insert a new line



The $'' syntax should do what you want:

 $vcs ci -m $'short\nlong'

On 2009-07-21, at 09:23 , Vadim Zeitlin wrote:

Hello,

I used to use literal ^M (entered as Ctrl-V Ctrl-M or Ctrl-V Enter) to
insert new lines on zsh command line, e.g.:

	% $vcs ci -m "Short description^MLonger description"

(for vcs=="git" you can just use 2 -m options but AFAIK the others don't support this). I don't actually know if this was ever supposed to work, as Ctrl-M does stand for "\r" and not "\n" but the fact is that it used to for
quite some time, I don't remember when did I start doing this but it
definitely worked in 4.3.2 under Cygwin and Debian.

But now that I upgraded to 4.3.10 I've found with some surprise that using
literal ^M now inserts "\r" and not "\n" under both Debian and Cygwin.
Under the latter there is also a new bug with completing DOS-style paths (mentioned e.g. at http://article.gmane.org/gmane.os.cygwin/102250 but I could find no trace of it in zsh-xxx archives nor any mention of a fix) so I rolled back to 4.3.4 which is the oldest zsh still available in Cygwin and it handles ^M in the same way, so the change to this happened between 4.3.2 and 4.3.4, i.e. a long time ago so maybe nobody remembers why was
this done any more but I'd still be curious to know if this change was
intentional and also if there is any way to insert a "\n" on the command line now other than using ^J (which does work but also visually breaks the
line which I dislike).

TIA!
VZ


--
Kurtis Rader
Caretaker of the exceptional canines Einstein and Haley






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