Shorten default title

This now skips the "fish" bit and uses prompt_pwd to print a shorter title.

See #8641.
This commit is contained in:
Fabian Homborg 2022-01-16 11:14:11 +01:00
parent ca12ce2494
commit 698b818935
2 changed files with 11 additions and 1 deletions

View File

@ -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
^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -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