#!/bin/ksh ## File: $HOME/.kshrc ## Date: 28.08.01 S. Abels ## # Dynamically set the xterm title and prompt # # HOST=`hostname` # PS1=']0;$USER@$HOST: $PWD$USER@$HOST:$PWD> ' # Aliases for commands # alias q='exit' # If it isn't an interactive shell, we don't need to defined keybindings. [[ -o interactive ]] || return 0 # Turn on command line editing mode set -o emacs # Set up cursor and function keys. No idea why the home and delete buttons don't work. # alias keymap emacs keyboard command # __D \E[D ^B left arrow move cursor left # __C \E[C ^F right arrow move cursor right # __A \E[A ^P up arrow previous history entry # __B \E[B ^N down arrow next history entry # __5~ \E[5 M-b prev move cursor back one word # __6~ \E[6 M-f next move cursor forward one word # __3~ \E[2 insert repeat previous argument # ^? ^D delete delete current character # __H ^A home move cursor to start of line # # Set positional parameters to corresponding code values (${27} = \033 = ESC) typeset -i _i=8#40 while ((_i -= 1)) do set -- "$(print -n \\0${_i#8?})" ${@+"$@"} done # define key aliases alias __A=${16} # up alias __B=${14} # down alias __C=$6 # right alias __D=$2 # left alias __5=${27}b${29} # previous alias __6=${27}f${29} # next alias __3="${27}b${27}f${27} ${27}${29} ${27}p${25}${29}" # insert char alias __H=$1 # home # cleanup shift 8#40-1 unset _i