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

Re: Zle "ctrl-v" quoting bug?



In the last episode (Jul 04), Johan Sundström said:
> I finally managed to bind shift-tab to reverse-menu-complete in Linux
> console mode, through tweaking a bit with my keymap and binding
> meta-tab to shift-tab. However, when trying to quote alt-tab using
> control-v alt-tab, an escape character is quoted (^[), and a beep is
> sent to the speaker, instead of generating the entire sequence ^[^I.
> How is that?
> 
> Similarly, I can't quote the tab character this way. Control-v tab or
> control-v control-i generates an unquoted tab

It's doing exactly what you asked for:  Control-V just inserts the very
next key into the buffer, without parsing it.  "^V Tab" sticks a raw
tab into your commandline (instead of trying to do a menucomplete). 
"^V ESC" sticks a raw escape into your commandline, but since you can't
usually see an escape, it prints "^[" instead.  Not that this is not
the two characters ^ and [, but one ESC character, printed so you can
see it.

If you try to "insert" an "ESC Tab" combo, the ^V only applies to the
ESC, since zsh has no idea that you redefined SHIFT-Tab to send two
control characters.  The only reason that things like "^V DOWN" or "^V
F1" work is that only the first character in those sequences is a
zsh-special character that needs to be inserted via ^V.

You might want to bind SHIFT-Tab to "ESC [ Z", which seems to be the
ANSI standard escape sequence for "Cursor Backward Tab", and add the
following to your termcap entry (if it's not already there): "bt=\E[Z".
Then add 

    bindkey ${$(echotc bt 2>&-):-"^[[Z"} reverse-menu-complete

to your startup file.  That'll let other terminals redefine backtab if
necessary, but will default to "ESC [ Z" if the 'bt' capability is
missing. 

	-Dan Nelson
	dnelson@xxxxxxxxxxxx



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