fish shell - Showing the current command in the window title of screen

久未见 提交于 2019-12-06 03:51:02

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!