#
# Init file for fish
#

#
# Set default field separators
#

set IFS \ \t\n

#
# Print a greeting 
#

if test $FISH_INTERACTIVE; 
  printf 'Welcome to fish, the friendly interactive shell\nType '; 
  set_color green; 
  printf 'help '; 
  set_color normal; 
  printf 'for instructions on how to use fish\n'; 
end

#
# Add X11 bin directory to path, if it exists. Note that pure console
# programs like makedep often live there, so we want this even for
# text-only terminals.
#

if test -d /usr/X11R6/bin
	if echo $PATH|grep /usr/X11R6/bin >/dev/null
	else
		set PATH $PATH:/usr/X11R6/bin
	end;
end;

#
# Set some value for LANG if nothing was set before
#

if test ! $LANG;
	set -gx LANG en_US.UTF-8
end;

#
# Set exit message
#

if test $FISH_INTERACTIVE; 
  set -g FISH_ON_EXIT 'echo Good bye'; 
end;

#
# Setup the CDPATH variable
#

if test $FISH_INTERACTIVE; 
  set -g CDPATH ".:~"; 
end;

#
# Put linux console in unicode mode. Should this be done in any other
# situation as well?
#

if test $TERM = linux;
	unicode_start
end


#
# Load additional initialization files
#

if test -d fish.d
# If this file is installed in /etc, the subdirectory is called fish.d
  for i in fish.d/*.fish
    . $i
  end
else
  if test -d .fish.d
# If this file is installed in ~, the subdirectory is called .fish.d
    for i in .fish.d/*.fish
      . $i
    end
  end
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.
#

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

#
# Set colors
#

if test $FISH_INTERACTIVE
  set -g FISH_COLOR_NORMAL normal
  set -g FISH_COLOR_ERROR red
  set -g FISH_COLOR_COMMAND green
  set -g FISH_COLOR_REDIRECTION normal
  set -g FISH_COLOR_COMMENT brown
  set -g FISH_COLOR_MATCH cyan
  set -g FISH_COLOR_PAGER_PREFIX cyan
  set -g FISH_COLOR_PAGER_COMPLETION normal
  set -g FISH_COLOR_PAGER_DESCRIPTION normal
  set -g FISH_COLOR_PAGER_PROGRESS cyan
end 
