Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
att
GitHub Repository: att/ast
Path: blob/master/docs/ksh/functions/keybind.txt
1798 views
1
typeset -A Keytable
2
trap 'eval "${Keytable[${.sh.edchar}]}"' KEYBD
3
function keybind # key action
4
{
5
typeset key=$(print -f "%q" "$2")
6
case $# in
7
2) Keytable[$1]='.sh.edchar=${.sh.edmode}'"$key"
8
;;
9
1) unset Keytable[$1]
10
;;
11
*) print -u2 "Usage: $0 key [action]"
12
;;
13
esac
14
}
15
16