我正在尝试获取当前的shell命令(不是$history[1]
!),特别是我希望能够使用特定的运行程序(例如python
(pwd)
替换fish_title- (pwd)
,如果我在交互式shell中, vim
等
From the documentation :
The first argument to fish_title will contain the most recently executed foreground command as a string, starting with fish 2.2.
So a simple
function fish_title
echo $argv (set -q SSH_CONNECTION; and hostname)":" $PWD
end
should work.
From the documentation, Special Variables
_, the name of the currently running command.
The default fish_title
function does this already, does it not?
function fish_title
echo $_ " "
set -q SSH_CONNECTION; and echo (hostname)":"
pwd
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.