Fish shell - display the current command in the title bar of the screen window

I want the current command to appear in the title of the screen (or tmux).

I tried the following settings, but it does not 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]\$ '
+4
source share
3 answers

Thank you for your responses. Finally, it 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
0
source

For the version for fish version 2.1.0 you only need to edit ~ / .config / fish / functions / fish_title.fish

function fish_title
    hostname
end

For version 1.23.1, this does not work. If directories do not exist, first create them:

mkdir -p ~ / .config / fish / functions /

+4
source

, fish_title. . .

- :

function fish_title
    echo $_ ' '
    pwd
end
funcsave fish_title

( , - ).

0
source

All Articles