-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpager
42 lines (36 loc) · 1.94 KB
/
pager
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
#!/bin/bash
# after: term
if command -v less>/dev/null; then
PAGER="$(command -v less)"
# sets default options to less
LESS='-SMRci'
# -S truncate rather than wraplong lines; type at runtime to toggle
# -M verbose prompts
# -R pass through raw control codes (e.g. ANSI color sequences)
# -c better full screen repaints
# -i case insensitive searches
# Colors for less, especially useful for man pages
export LESS_TERMCAP_mb=$(printf '\e[01;31m') # begin blinking
export LESS_TERMCAP_md=$(printf '\e[01;31m') # begin bold
export LESS_TERMCAP_me=$(printf '\e[0m') # end mode
export LESS_TERMCAP_so=$(printf '\e[01;44;30m') # begin standout-mode - info box and search matches
export LESS_TERMCAP_se=$(printf '\e[0m') # end standout-mode
export LESS_TERMCAP_us=$(printf '\e[01;32m') # begin underline
export LESS_TERMCAP_ue=$(printf '\e[0m') # end underline
if [ "$COLORTERM" = "truecolor" ]; then
# Upgrade to darkula scheme when in a truecolor terminal
export LESS_TERMCAP_mb=$'\E[38;2;135;135;175m ' # begin blinking
export LESS_TERMCAP_md=$'\E[38;2;95;135;95m' # begin bold
export LESS_TERMCAP_me=$'\E[0m' # end mode
export LESS_TERMCAP_so=$'\E[38;2;18;18;18;48;2;215;175;0m' # begin standout-mode - info box and search matches
export LESS_TERMCAP_se=$'\E[0m' # end standout-mode
export LESS_TERMCAP_us=$'\E[38;2;135;135;175m ' # begin underline
export LESS_TERMCAP_ue=$'\E[0m' # end underline
elif [ "$(tput colors)" -eq 256 ] || [[ $TERM == *-256color ]]; then
# Upgrade some of the colors in 256 color terminals
export LESS_TERMCAP_md=$'\E[01;38;5;74m'
export LESS_TERMCAP_so=$'\E[38;5;220m'
export LESS_TERMCAP_us=$'\E[04;38;5;146m'
fi
export LESS PAGER
fi