You are not logged in.
Pages: 1
Regarding e. g. the key codes (like "\e[5D") given in this section of zsh's ArchWiki page. How can one find out which actual keys they represent (and vice versa)? dumpkeys for instance does not appear to yield all of them, or at least not in that format.
Last edited by misc (2011-01-14 19:55:59)
Offline
Press CTRL+v and then a key and you get that keys keycode.
Offline
Press CTRL+v and then a key and you get that keys keycode.
That does not work with certain keys (alt, shift etc.), though. Thanks still.
Offline
1) escape sequences may differ by terminal
2) i do not think any terminal has sequences for alt, shift, etc.
3) nice hat
Last edited by fsckd (2011-01-13 02:41:00)
aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies
Offline
1) So… no way to find out which keys the sequences as given e. g. in the wiki represent? (Couldn't somebody who uses them just write it down, please?)
I have urxvt as terminal; the extra sequences with "For rxvt" as comment lead me to think that the rest must be compatible.
2) kk
3) Thanks!
Offline
There is a database but it's sort of incomplete. These things are called terminal capabilities and can be accessed from a curses library (e.g. ncurses) or using tput if in a shell script. I use the utility infocmp to see the entries for a specific terminal. For example, `infocmp xterm`.
aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies
Offline
The clean way to do it is to use man terminfo and then use zsh's terminfo feature.
example:
if [[ -n $terminfo[khome] ]]; then
bindkey "$terminfo[khome]" vi-beginning-of-line
bindkey -M vicmd "$terminfo[khome]" vi-beginning-of-line
fi
This works for pretty much every terminal, but xterm has application/cursor modes and zsh won't follow that by default, but you can fix xterm with something like this:
# make zsh/terminfo work for terms with application and cursor modes
case "$TERM" in
xterm*)
zle-line-init() { zle-keymap-select; echoti smkx }
zle-line-finish() { echoti rmkx }
zle -N zle-line-init
zle -N zle-line-finish
;;
esac
Last edited by thestinger (2011-01-14 19:29:25)
Offline
Thanks everybody for the answers. I still don't fully know how to interpret the sequences in the wiki, but should be able to set up the keys in my zshrc (there's also an article on bindkeys in the ZshWiki) appropriately.
Offline
I just got this tip at #archlinux from fryguy:
$ cat
<hit the key you want here>
copy the code and it works
Don't panic !
Offline
Pages: 1