From df240b36e241945b96d439430c0659a680626736 Mon Sep 17 00:00:00 2001 From: Jessie Hildebrandt Date: Mon, 4 Nov 2019 10:17:09 +0000 Subject: [PATCH] Update fish_title to be Fish 2.X.X compatible --- config.fish | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/config.fish b/config.fish index d2419e7..3d4a8e0 100644 --- a/config.fish +++ b/config.fish @@ -14,7 +14,7 @@ # * Abbreviated + colorized working directory # * VCS status # * Dynamic prompt character (root/user, return status) -# * Dynamic greeting function () +# * Dynamic greeting function # * Optional timestamps # # Configurable variables: @@ -131,8 +131,18 @@ function fish_title --description 'Print the title of the window' return end - # Set title to the command status + working directory - echo (status current-command) (__fish_pwd) + # Set window title to the current command + working directory + if test (echo $FISH_VERSION | cut -d "." -f 1) -ge 3 + + # Fish 3.X.X and above use "status current-command" + echo (status current-command) (__fish_pwd) + + else + + # Older versions of fish use the "$_" variable + echo $_ (__fish_pwd) + + end end