-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path256-color-italic
executable file
·45 lines (40 loc) · 1.17 KB
/
256-color-italic
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
#!/bin/bash
# Fix screen terminfo to support italics
create_terminfo_screen_it()
{
# Create custom terminfo from screen-256color to support italics
if [[ ! -f "$HOME/.terminfo/s/screen-256color-it" ]]; then
mkdir -p $HOME/.terminfo
infocmp screen-256color | sed \
-e 's/^screen[^|]*|[^,]*,/screen-256color-it|screen with italics support,/' \
-e 's/%?%p1%t;3%/%?%p1%t;7%/' \
-e 's/smso=[^,]*,/smso=\\E[7m,/' \
-e 's/rmso=[^,]*,/rmso=\\E[27m,/' \
-e '$s/$/ sitm=\\E[3m, ritm=\\E[23m,/' \
> /tmp/terminfo
tic /tmp/terminfo
fi
}
# Pick up a better terminal with italics support
case "$TERM" in
xterm*)
if infocmp rxvt-unicode-256color >/dev/null 2>&1; then
export TERM=rxvt-unicode-256color
fi
;;
screen*)
create_terminfo_screen_it
if infocmp screen-256color-it >/dev/null 2>&1; then
export TERM=screen-256color-it
elif infocmp screen-256color >/dev/null 2>&1; then
export TERM=screen-256color
fi
;;
esac
exe_name=`basename ${BASH_SOURCE[0]}`
# Find and launch first suitable real executable
for p in ${PATH//:/$'\n'}; do
[[ -x "$p/$exe_name" ]] || continue
[[ "$p/$exe_name" == ${BASH_SOURCE[0]} ]] && continue
exec "$p/$exe_name" "$@"
done