 <p>Give this a try:</p> <pre><code>_key_handler () { # by Dennis Williamson - 2011-01-14 # for http://stackoverflow.com/questions/4690695/remapping-keys-for-ksh-vi-mode # 2011-01-15 - added cursor color change typeset timeout=1 # whole seconds # the cursor color change sequences are for xterms that support this feature if [[ $TERM == *xterm*color* ]] then typeset color=true # change cursor color when chars are held # cursor colors - set them as you like typeset nohold="\E]12;green\a" hold="\E]12;red\a" else typeset color=false fi if [[ ${.sh.edmode} == $'\x1b' ]] # vi edit mode then case ${.sh.edchar} in j) if [[ $_kh_prevchar == j ]] then if (( $SECONDS &lt; _kh_prevtime + timeout )) then .sh.edchar=$'\E' # remapped sequence _kh_prevchar='' $color &amp;&amp; printf "$nohold" fi else _kh_prevchar=${.sh.edchar} .sh.edchar='' $color &amp;&amp; printf "$hold" &amp;&amp; # jiggle the cursor so the color change shows tput cuf1 &amp;&amp; sleep .02 &amp;&amp; tput cub1 fi _kh_prevtime=$SECONDS ;; *) if [[ -n $_kh_prevchar ]] then .sh.edchar=$_kh_prevchar${.sh.edchar} fi _kh_prevchar='' $color &amp;&amp; printf "$nohold" ;; esac fi } trap _key_handler KEYBD set -o vi </code></pre> <p>Put it in a file, <code>~/.input.ksh</code> for example, and source it from your <code>~/.kshrc</code> or similar.</p> <p>Pressing "j" will put it on hold. If the time runs out before pressing another "j", the first "j" will be output and the next one will be held. If another key besides "j" is pressed, the held "j" and the next character are output together. If a second "j" is pressed before time runs out, the remapped sequence will be output.</p> <p>Example: Pressing "j", pause, then press "jj" will yield no response at first then "j&lt;&lt; Esc>>" all at once.</p> <p>A difference between this and <code>vim</code> is that <code>vim</code> will go ahead and output the held character after the time runs out even if another key hasn't been pressed yet. Also, the timeout in this is in whole seconds, while in <code>vim</code> it's in milliseconds.</p> <p>I've only tested this a little and only with ksh93.</p> <p><strong>Edit:</strong> Added cursor color change.</p>