I tried to add $status
to my prompt in the fish shell but it always prints 0.
This question was asked on irc a while back and i'm surprised there wasn't a answer here so i thought i'd post it here as well.
This is because any function / command you call from within your prompt will reset the value. To make it work assign the value to another variable as the first thing you do in your fish_prompt or fish_right_prompt function.
function fish_prompt --description 'Write out the prompt'
set -l _display_status $status
...
printf '%s' $_display_status
end