change fish shell prompt based on hostname

2018-08-04T03:05:02

How do I go about changing my fish shell prompt when I'm on a different machine via ssh.

I get it working with running a set -q __fish_prompt_hostname at the top of my prompt config and "$__fish_prompt_hostname" when I want to call it, but when I ssh to another machine it cannot find the hostname and display it.

I know in bash $HOSTNAME is the way to go, but with fish I'm not sure how to get the hostname. (I also would like to change the colors of my prompt based on the hostname due to some machines being more volatile than others.)

Any suggestions?

Copyright License:
Author:「Dorilds」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/51678701/change-fish-shell-prompt-based-on-hostname

About “change fish shell prompt based on hostname” questions

How do I go about changing my fish shell prompt when I'm on a different machine via ssh. I get it working with running a set -q __fish_prompt_hostname at the top of my prompt config and "$
To make some minor changes to the fish prompt, I modified fish_prompt.fish/fish_right_prompt.fish files in the ~/.config/fish/ directory, but that does not change anything. 'functions --details
I tried following the steps here to configure the prompt: https://nixos.wiki/wiki/Fish Combined with the information here about the location and content of a basic file: https://fishshell.com/docs/
I'm trying to convert my bashrc configuration into the fish shell config, and I have this part in the prompt: function fish_prompt .... if [ $RETVAL -ne 0 ] printf "✘" else printf "
I want fish shell to show full path in prompt. Looking at source of pwd_prompt I see a variable named fish_prompt_pwd_dir_length, that should do what I want if I set it to 0. But when I do set -U
I'm trying to generate git status in my fish shell prompt. The problem I'm having is that getting git status is a little bit slow. So, I would like to keep the current git status in a global vari...
Is it possible to force Fish shell extention TIDE to use fish_git_prompt instead of its own _tide_item_git.fish? My goal is to make TIDE git prompt identical to this tutorial. Right now with defaul...
I am using fish as my primary shell; along with oh-my-fish Now the first character on the fish prompt is really weird [I] as shown in the picture Kindly help me get rid of the character.
I'm considering switching from zsh to fish, however before I do I want to compare the speeds at which the prompts load. I have a ZSH function which would time 10 times how long it would take for the
I have the fish shell installed on my Mac OS X via Homebrew. To configure the Terminal application to use the fish shell instead of the bash shell, I ran chsh -s /usr/local/bin/fish once to change my

Copyright License:Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.