问题
I want the current command to be shown in the title of screen (or tmux).
I tried following settings but it doesn't work.
How can I make it work?
.screenrc
shelltitle "$ |fish"
shell /usr/local/bin/fish
.config/fish/config.fish
set -x PS1 '\033k\033\\[\u@\h \W]\$ '
回答1:
For fish version 2.1.0 you only have to edit ~/.config/fish/functions/fish_title.fish
function fish_title
hostname
end
For version 1.23.1 this doesn't seem to work. If the directories do not exist, first create them:
mkdir -p ~/.config/fish/functions/
回答2:
I think you're looking for fish_title
. See documentation here.
You could do something like this:
function fish_title
echo $_ ' '
pwd
end
funcsave fish_title
(Note you just run this at a prompt - don't put it in a config file).
回答3:
Thanks for your answers. Finally, this made it work!
.screenrc
shelltitle "$ |fish"
shell /usr/local/bin/fish
.config/fish/config.fish
function fish_prompt
echo -ne '\033k'
echo -ne $argv
echo -ne '\033\\'
echo -ne '$ '
end
来源:https://stackoverflow.com/questions/24885174/fish-shell-showing-the-current-command-in-the-window-title-of-screen