aboutsummaryrefslogtreecommitdiffhomepage
path: root/etc/fish_interactive.fish.in
blob: bbd89ab9e3f61362874106afd8ee91afb3347c68 (plain)
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#
# Initializations that should only be performed when in interactive mode
#
# @configure_input@

if not status --is-interactive
	exit
end

#
# Print a greeting 
#

printf (_ 'Welcome to fish, the friendly interactive shell\n')
printf (_ 'Type %shelp%s for instructions on how to use fish\n') (set_color green) (set_color normal)

#
# Set exit message
#

function fish_on_exit -d (_ "Commands to execute when fish exits") --on-process %self
	printf (_ "Good bye\n")
end

#
# Set INPUTRC to something nice
#
# We override INPUTRC if already set, since it may be set by a shell 
# other than fish, which may use a different file. The new value should
# be exported, since the fish inputrc file plays nice with other files 
# by including them when found.
# Give priority to the default file installed with fish in 
# @SYSCONFDIR@/fish_inputrc.
#

for i in ~/.fish_inputrc @SYSCONFDIR@/fish_inputrc ~/.inputrc /etc/inputrc
	if test -f $i
		set -xg INPUTRC $i
		break
	end
end


#
# Set various color values
#

function set_default -d "Set an exported universal variable, unless it has already been set"
	if not set -q $argv[1]
		set -Ux -- $argv	
	end
end

function set_exported_default -d "Set an exported universal variable, unless it has already been set"
	if not set -q $argv[1]
		set -Ux -- $argv	
	end
end


# Regular syntax highlighting colors
set_default fish_color_normal normal
set_default fish_color_command green
set_default fish_color_redirection normal
set_default fish_color_comment brown
set_default fish_color_error red

set_default fish_color_cwd green

# Background color for matching quotes and parenthesis
set_default fish_color_match cyan

# Background color for search matches
set_default fish_color_search_match purple

# Pager colors
set_default fish_pager_color_prefix cyan
set_default fish_pager_color_completion normal
set_default fish_pager_color_description normal
set_default fish_pager_color_progress cyan

# Directory history colors
set_default fish_color_history_current cyan


#
# Setup the CDPATH variable
#

set_default CDPATH . ~

#
# Match colors for grep, if supported
#

if grep --color=auto --help 1>/dev/null 2>/dev/null
	set_exported_default GREP_COLOR '97;45'
	set_exported_default GREP_OPTIONS '--color=auto'
end

#
# Color definitions for ls, if supported
#

if command ls --color=auto --help 1>/dev/null 2>/dev/null

	set -l color_document 35
	set -l color_image '01;35'
	set -l color_sound '01;35'
	set -l color_video '01;35'
	set -l color_archive '01;31'
	set -l color_command '01;32'
	set -l color_backup 37

	set -l default no=00 fi=00 'di=01;34' 'ln=01;36' 'pi=40;33' 'so=01;35' 'bd=40;33;01' 'cd=40;33;01' 'or=01;05;37;41' 'mi=01;05;37;41' ex=$color_command 

	for i in .cmd .exe .com .btm .bat .sh .csh .fish
		set default $default "*$i=$color_command"
	end
		
	for i in .tar .tgz .arj .taz .lhz .zip .z .Z .gz .bz2 .bz .tz .rpm .cpio .jar .deb .rar .bin .hqx
		set default $default "*$i=$color_archive"
	end

	for i in .jpg .jpeg .gif .bmp .xbm .xpm .png .tif 
		set default $default "*$i=$color_image"
	end

	for i in .mp3 .au .wav .aiff .ogg .wma 
		set default $default "*$i=$color_sound"
	end

	for i in .avi .mpeg .mpg .divx .mov .qt .wmv .rm
		set default $default "*$i=$color_video"
	end

	for i in .htm .html .rtf .wpd .doc .pdf .ps .xls .swf .txt .tex .sxw .dvi INSTALL README ChangeLog
		set default $default "*$i=$color_document" 
	end
	
	for i in '~' .bak
		set default $default "*$i=$color_backup" 
	end

	set -gx LS_COLORS $default
end


#
# Remove temporary functions
#

functions -e set_exported_default
functions -e set_default