aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc_src/index.hdr.in6
-rw-r--r--share/functions/__fish_config_interactive.fish16
2 files changed, 16 insertions, 6 deletions
diff --git a/doc_src/index.hdr.in b/doc_src/index.hdr.in
index 5cf418a5..3e2f9f47 100644
--- a/doc_src/index.hdr.in
+++ b/doc_src/index.hdr.in
@@ -1256,6 +1256,12 @@ end
</pre>
</p>
+\subsection greeting Configurable greeting
+
+If a function named fish_greeting exists after initialization, it will
+be run when entering interactive mode. Otherwise,if an environment
+variable named fish_greeting exists, it will be printed.
+
\subsection event Event handlers
When defining a new function in fish, it is possible to make it into an
diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish
index 02a03663..11ad9854 100644
--- a/share/functions/__fish_config_interactive.fish
+++ b/share/functions/__fish_config_interactive.fish
@@ -146,13 +146,17 @@ function __fish_config_interactive -d "Initializations that should be performed
# Print a greeting
#
- if set -q fish_greeting
- switch $fish_greeting
- case ''
- # If variable is empty, don't print anything, saves us a fork
+ if functions -q fish_greeting
+ fish_greeting
+ else
+ if set -q fish_greeting
+ switch $fish_greeting
+ case ''
+ # If variable is empty, don't print anything, saves us a fork
- case '*'
- echo $fish_greeting
+ case '*'
+ echo $fish_greeting
+ end
end
end