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

Zsh and the MyTouch Slide

I recently replaced my poor old discontinued SideKick with a MyTouch
Slide, which is an Android phone.  I installed the ConnectBot SSH client
so I can log in to my desktop at work from the phone.  So far so good.

Problem:  The hardware keypad on this particular phone doesn't have a "|"
key, and it's four taps to get one via softkeys.  Also, you can't see the
screen when using the softkeys, which is kind of annoying.  There are a
number of other keys it's similarly difficult to access.

However, there is a hardware key labeled SYM for which ConnectBot sends
an unlikely four-byte sequence, perfect for bindkey.  The following is
deliberately written to avoid "modern" zsh features so it should work on
zsh installations up to several years old, but it may not work if you
are using a multibyte character set.

Tweak the value of "replace" per your preferences.

--- 8< --- snip --- 8< ---

# For ConnectBot on the MyTouch Slide
# autoload -U mytouch
# zle -N mytouch
# bindkey '\M-n\M-<\M-^A' mytouch

emulate -LR zsh

local key
local -A replace

    /	\\
    L	'|'
    l	'|'
    j	'['
    k	']'
    J	'{'
    K	'}'
    '('	'<'
    ')'	'>'
    ','	'<'
    '.'	'>'

zle -R "SYMBOL:"
read -k 1 key

if (( $+replace[$key] ))
then LBUFFER="$LBUFFER"$replace[$key]

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