From 698b8189356c8224443fdfc4399408f932d53aca Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sun, 16 Jan 2022 11:14:11 +0100 Subject: [PATCH] Shorten default title This now skips the "fish" bit and uses prompt_pwd to print a shorter title. See #8641. --- CHANGELOG.rst | 1 + share/functions/fish_title.fish | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 000918698..50b000bd6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -115,6 +115,7 @@ Interactive improvements - The clipboard bindings ignore X-based clipboard programs if the ``DISPLAY`` environment variable is not set, which helps prefer the Windows clipboard when it is available (such as on WSL). - ``funcsave`` will remove a saved copy of a function that has been erased with ``functions --erase``. - The Web-based configuration tool gained a number of improvements, including the ability to set pager colors. +- The default ``fish_title`` prints a shorter title with shortened $PWD and no more redundant "fish" (:issue:`8641`). New or improved bindings ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/share/functions/fish_title.fish b/share/functions/fish_title.fish index 800f2d8f1..ec3d3e5ff 100644 --- a/share/functions/fish_title.fish +++ b/share/functions/fish_title.fish @@ -3,6 +3,15 @@ function fish_title if not set -q INSIDE_EMACS; or string match -vq '*,term:*' -- $INSIDE_EMACS # An override for the current command is passed as the first parameter. # This is used by `fg` to show the true process name, among others. - echo (set -q argv[1] && echo $argv[1] || status current-command) (__fish_pwd) + if set -q argv[1] + echo -- $argv[1] (prompt_pwd -d 1 -D 0) + else + # Don't print "fish" because it's redundant + set -l command (status current-command) + if test "$command" = fish + set command + end + echo -- $command (prompt_pwd -d 1 -D 1) + end end end