Skip to content

Commit

Permalink
Only set various startup defaults once. Even if the user removes them…
Browse files Browse the repository at this point in the history
…, do not try to reset them.

darcs-hash:20080108161856-75c98-7d228f7a0c62aa8be74f66ce72d0cadbc3030f5d.gz
  • Loading branch information
liljencrantz committed Jan 8, 2008
1 parent 286ce1d commit da4a4bc
Showing 1 changed file with 58 additions and 56 deletions.
114 changes: 58 additions & 56 deletions share/functions/__fish_config_interactive.fish
Original file line number Diff line number Diff line change
Expand Up @@ -74,91 +74,93 @@ function __fish_config_interactive -d "Initializations that should be performed
end

#
# Print a greeting
#

#
# If we are starting up for the first time, set the default greeting
# If we are starting up for the first time, set various defaults
#

if not set -q __fish_init_1_23_0
if not set -q fish_greeting
set -l line1 (printf (_ 'Welcome to fish, the friendly interactive shell') )
set -l line2 (printf (_ 'Type %shelp%s for instructions on how to use fish') (set_color green) (set_color normal))
set -U fish_greeting $line1\n$line2
end
set -U __fish_init_1_23_0
end

switch $fish_greeting
case ''
# If variable is empty, don't print anything, saves us a fork

case '*'
echo $fish_greeting
end
#
# Set various defaults using these throwaway functions
#

#
# Set exit message
#
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

function fish_on_exit --description "Commands to execute when fish exits" --on-process %self
printf (_ "Good bye\n")
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 various defaults using these throwaway functions
#
set_default fish_color_cwd green
set_default fish_color_cwd_root red

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
# Background color for matching quotes and parenthesis
set_default fish_color_match cyan

# 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
# Background color for search matches
set_default fish_color_search_match purple

set_default fish_color_cwd green
set_default fish_color_cwd_root red
# 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

# Background color for matching quotes and parenthesis
set_default fish_color_match cyan
#
# Directory history colors
#

# Background color for search matches
set_default fish_color_search_match purple
set_default fish_color_history_current cyan

# 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
#
#
# Setup the CDPATH variable
#

set_default fish_color_history_current cyan
set_default CDPATH . ~

#
# Remove temporary functions for setting default variable values
#

functions -e set_default

end

#
# Setup the CDPATH variable
# Print a greeting
#

set_default CDPATH . ~
switch $fish_greeting
case ''
# If variable is empty, don't print anything, saves us a fork

case '*'
echo $fish_greeting
end

#
# Remove temporary functions for setting default variable values
# Set exit message
#

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

#
# This event handler makes sure the prompt is repainted when
Expand Down

0 comments on commit da4a4bc

Please sign in to comment.