-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcorrect_term_setting
More file actions
83 lines (76 loc) · 2.23 KB
/
correct_term_setting
File metadata and controls
83 lines (76 loc) · 2.23 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# For slightly off-beat settings of TERM, make a useful guess of what
# setting might be compatible. Without this, terminal-based programs like
# bash and vim are less likely to work correctly. Ensure that
# ncurses/ncurses-term/tput are installed to maximize the number of
# available terminfos.
if is_interactive; then
# From a comment on
# http://vim.wikia.com/wiki/256_colors_in_vim
# In cygwin, make sure ncurses is installed (tput needs it).
# In ubuntu, be sure to install ncurses-term so that gnome-256color is
# recognized.
if [ "$TERM" = "xterm" ] ; then
if [ -z "$COLORTERM" ] ; then
if [ -z "$XTERM_VERSION" ] ; then
echo "Warning: Terminal wrongly calling itself 'xterm'."
else
case "$XTERM_VERSION" in
"XTerm(256)") TERM="xterm-256color" ;;
"XTerm(88)") TERM="xterm-88color" ;;
"XTerm") ;;
*)
echo "Warning: Unrecognized XTERM_VERSION: $XTERM_VERSION"
;;
esac
fi
else
case "$COLORTERM" in
gnome-terminal)
# Those crafty Gnome folks require you to check COLORTERM,
# but don't allow you to just *favor* the setting over TERM.
# Instead you need to compare it and perform some guesses
# based upon the value. This is, perhaps, too simplistic.
TERM="gnome-256color"
;;
*)
echo "Warning: Unrecognized COLORTERM: $COLORTERM"
;;
esac
fi
fi
SCREEN_COLORS="`tput colors`"
if [ -z "$SCREEN_COLORS" ] ; then
case "$TERM" in
screen-*color-bce)
echo "Unknown terminal $TERM. Falling back to 'screen-bce'."
export TERM=screen-bce
;;
*-88color)
echo "Unknown terminal $TERM. Falling back to 'xterm-88color'."
export TERM=xterm-88color
;;
*-256color)
echo "Unknown terminal $TERM. Falling back to 'xterm-256color'."
export TERM=xterm-256color
;;
esac
SCREEN_COLORS=`tput colors`
fi
if [ -z "$SCREEN_COLORS" ] ; then
case "$TERM" in
gnome*|xterm*|konsole*|aterm|[Ee]term)
echo "Unknown terminal $TERM. Falling back to 'xterm'."
export TERM=xterm
;;
rxvt*)
echo "Unknown terminal $TERM. Falling back to 'rxvt'."
export TERM=rxvt
;;
screen*)
echo "Unknown terminal $TERM. Falling back to 'screen'."
export TERM=screen
;;
esac
SCREEN_COLORS=`tput colors`
fi
fi