move fish_title to a dedicated file

This commit is contained in:
Daniel Micay 2024-11-29 12:42:08 -05:00
parent 0dd981f389
commit a3b029d3c5
2 changed files with 18 additions and 19 deletions

View File

@ -15,25 +15,6 @@ if set -q TERM && test $TERM = alacritty && ! set -q COLORTERM
end
if status is-interactive
function fish_title
# If we're connected via ssh, we print the hostname.
set -l ssh
set -q SSH_TTY
and set ssh "["(prompt_hostname | string sub -l 20 | string collect)"]"
# 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.
if set -q argv[1]
echo -- $ssh (string sub -l 20 -- $argv[1]) (prompt_pwd -d 1 -D 4)
else
# Don't print "fish" because it's redundant
set -l command (status current-command)
if test "$command" = fish
set command
end
echo -- $ssh (string sub -l 20 -- $command) (prompt_pwd -d 1 -D 4)
end
end
alias rsync 'rsync --preallocate'
alias diff 'diff --color=auto'
alias grep 'grep --color=auto'

View File

@ -0,0 +1,18 @@
function fish_title
# If we're connected via ssh, we print the hostname.
set -l ssh
set -q SSH_TTY
and set ssh "["(prompt_hostname | string sub -l 20 | string collect)"]"
# 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.
if set -q argv[1]
echo -- $ssh (string sub -l 20 -- $argv[1]) (prompt_pwd -d 1 -D 4)
else
# Don't print "fish" because it's redundant
set -l command (status current-command)
if test "$command" = fish
set command
end
echo -- $ssh (string sub -l 20 -- $command) (prompt_pwd -d 1 -D 4)
end
end