You are not logged in.

#1 2012-10-30 16:26:08

t4711
Member
Registered: 2012-10-12
Posts: 21

[Solved... sort of] echoti errors during zsh key binding

Another day, another problem. I am using zsh both in the console and in an Xfce terminal window. Some of my homegrown key bindings work in the console but not in Xfce.

After some googling I found a few posts about the "proper" way to do key bindings, basically like this:

typeset -A key
key[Home]=${terminfo[khome]}
... more
# setup key accordingly
[[ -n "${key[Home]}"    ]]  && bindkey  "${key[Home]}"    beginning-of-line
... more
# Finally, make sure the terminal is in application mode, when zle is
# active. Only then are the values from $terminfo valid.
function zle-line-init () {
    echoti smkx
}
function zle-line-finish () {
    echoti rmkx
}

zle -N zle-line-init
zle -N zle-line-finish

All key bindings work in both environments but the echoti invocations produce error messages in the console (but not in the Xfce terminal emulator window):

echoti: no such terminfo capability: smkx

(or ... rmkx)

I googled for that as well but I wasn't lucky. Anyone an idea what's going on here?

Last edited by t4711 (2012-11-02 11:59:43)

Offline

#2 2012-11-01 22:54:47

Fetid Frog
Member
From: UK
Registered: 2010-04-16
Posts: 24

Re: [Solved... sort of] echoti errors during zsh key binding

I switched to zsh today and noticed the same thing.  I fixed it by putting the last part in an 'if' block:

if [[ -n ${terminfo[smkx]} ]] && [[ -n ${terminfo[rmkx]} ]]; then
        function zle-line-init () {echoti smkx}
        function zle-line-finish () {echoti rmkx}

        zle -N zle-line-init
        zle -N zle-line-finish
fi

Offline

#3 2012-11-02 11:59:06

t4711
Member
Registered: 2012-10-12
Posts: 21

Re: [Solved... sort of] echoti errors during zsh key binding

Yeah, I ended up doing sth similar (there are other bits and pieces in my zle-line-init() and zle-line-finish() so your solution, though more efficient, doesn't work for me):

function zle-line-init () {
	if (( ${+terminfo[smkx]} )); then
		echoti smkx
	fi
}
function zle-line-finish () {
	if (( ${+terminfo[rmkx]} )); then
		echoti rmkx
	fi
}

However, I feel this sort of swerves around the problem. Whether that's good enough, I don't know.

(Aside: the number of hoops Linux make you jump through to enable a few basic keys on a bog-standard PC keyboard is quite impressive. And that's nothing to do with Arch itself or The Arch Way: before I decided to go with Arch I tried a plain Debian and a Mint system and the picture was pretty similar.)

Offline

#4 2013-01-01 23:08:08

pmav99
Member
Registered: 2007-12-20
Posts: 5

Re: [Solved... sort of] echoti errors during zsh key binding

I had the same problem. Debian package seems to do the same, so probably this is the way to go
https://github.com/ft/pkg-zsh/commit/0b … 4f594c2570
https://github.com/ft/pkg-zsh/commit/ab … c320a3fdd9

Offline

Board footer

Powered by FluxBB