-
Notifications
You must be signed in to change notification settings - Fork 1
/
.kshedit
62 lines (56 loc) · 1.82 KB
/
.kshedit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#
# .kshedit - ksh editing function customisation
#
#ident "@(#)HOME:.kshedit 37.2 22/02/23 17:21:21 (woods)"
# XXX this can't be checked in with a "diff" that treats it as binary!
set -o gmacs
if [ -n "$KSH_VERSION" ] ; then
#
# this is probably pdksh (or it could be ksh93t or later), but
# it probably doesn't have the emacs-usemeta option
#
case "$(set -o)" in
*emacs-usemeta*)
set -o emacs-usemeta
;;
esac
fi
if ( type bind ) > /dev/null 2>&1 ; then
# Commonly the HOME and END keys....
#
bind '^XH'=beginning-of-line
bind '^XF'=end-of-line
# only(?) OpenBSD and NetBSD have this by default
#
bind '^I'=complete-list
# some of these might also be useful for pdksh:
#
#bind '^X1~'=beginning-of-line
#bind '^X7~'=beginning-of-line
#bind '^X4~'=end-of-line
#bind '^X8~'=end-of-line
#bind '^XF'=end-of-line
#bind '^X3~'=delete-char-forward
else
# these aliases only work in emacs/gmacs mode
#
# they use the magic of the "M-[X" binding, meaning when the editor
# reads "M-[" followed by a letter, it searches the alias list for an
# alias maatching "__X" and if found it inserts the alias value into the
# input stream
#
# In ksh93 all but the last one ("M-[F") are aslo the default bindings.
#
# xxx Eventually instead of direct control characters it may be possible
# to porably use dollar-single-quote character literals (e.g. $'\xFF'),
# but currently only ksh93 and newer, plus newer Bash (as well as some
# recent Ash descendents) support these, and they're still an open
# proposal for POSIX.
#
alias __A="$(printf '\020')" # ^P: up arrow
alias __B="$(printf '\016')" # ^N: down arrow
alias __C="$(printf '\006')" # ^F: right arrow
alias __D="$(printf '\002')" # ^B: left arrow
alias __F="$(printf '\005')" # ^E: end of line, END key
alias __H="$(printf '\001')" # ^A: beginning of line, HOME key
fi