1

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.

1 Answer 1

2

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .