Only set various startup defaults once. Even if the user removes them, do not try to reset them.

darcs-hash:20080108161856-75c98-7d228f7a0c62aa8be74f66ce72d0cadbc3030f5d.gz
This commit is contained in:
liljencrantz 2008-01-09 02:18:56 +10:00
parent 286ce1d6a4
commit da4a4bcc18

View File

@ -74,12 +74,9 @@ function __fish_config_interactive -d "Initializations that should be performed
end end
# #
# Print a greeting # If we are starting up for the first time, set various defaults
#
#
# If we are starting up for the first time, set the default greeting
# #
if not set -q __fish_init_1_23_0 if not set -q __fish_init_1_23_0
if not set -q fish_greeting if not set -q fish_greeting
set -l line1 (printf (_ 'Welcome to fish, the friendly interactive shell') ) set -l line1 (printf (_ 'Welcome to fish, the friendly interactive shell') )
@ -87,8 +84,68 @@ function __fish_config_interactive -d "Initializations that should be performed
set -U fish_greeting $line1\n$line2 set -U fish_greeting $line1\n$line2
end end
set -U __fish_init_1_23_0 set -U __fish_init_1_23_0
#
# Set various defaults using these throwaway functions
#
function set_default -d "Set a universal variable, unless it has already been set"
if not set -q $argv[1]
set -U -- $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 red
set_default fish_color_error red --bold
set_default fish_color_escape cyan
set_default fish_color_operator cyan
set_default fish_color_quote brown
set_default fish_color_valid_path --underline
set_default fish_color_cwd green
set_default fish_color_cwd_root red
# 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 . ~
#
# Remove temporary functions for setting default variable values
#
functions -e set_default
end end
#
# Print a greeting
#
switch $fish_greeting switch $fish_greeting
case '' case ''
# If variable is empty, don't print anything, saves us a fork # If variable is empty, don't print anything, saves us a fork
@ -105,61 +162,6 @@ function __fish_config_interactive -d "Initializations that should be performed
printf (_ "Good bye\n") printf (_ "Good bye\n")
end end
#
# Set various defaults using these throwaway functions
#
function set_default -d "Set a universal variable, unless it has already been set"
if not set -q $argv[1]
set -U -- $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 red
set_default fish_color_error red --bold
set_default fish_color_escape cyan
set_default fish_color_operator cyan
set_default fish_color_quote brown
set_default fish_color_valid_path --underline
set_default fish_color_cwd green
set_default fish_color_cwd_root red
# 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 . ~
#
# Remove temporary functions for setting default variable values
#
functions -e set_default
# #
# This event handler makes sure the prompt is repainted when # This event handler makes sure the prompt is repainted when
# fish_color_cwd changes value. Like all event handlers, it can't be # fish_color_cwd changes value. Like all event handlers, it can't be