acomagu / fish-async-prompt

Make your prompt asynchronous to improve the reactivity.
MIT License
389 stars 22 forks source link

call to fish_right_prompt breaks in fish 3.4.1 #54

Closed krry closed 2 years ago

PaulGrandperrin commented 2 years ago

I also have this error in fish 3.4.0

PaulGrandperrin commented 2 years ago

The error looks like this:

Welcome to fish, the friendly interactive shell
Type `help` for instructions on how to use fish
paulg@MacBookPaul ~/g/fish-async-prompt (master)> source conf.d/__async_prompt.fish
paulg@MacBookPaul ~/g/fish-async-prompt (master)> function fish_right_prompt; echo "test"; end
paulg@MacBookPaul ~/g/fish-async-prompt (master)> fish: Unknown command: fish_right_prompt                                                                test
fish:
    fish_right_prompt | read -z prompt
    ^
paulg@MacBookPaul ~/g/fish-async-prompt (master)>                                                                                                         test
acomagu commented 2 years ago

@PaulGrandperrin Thanks, I reproduced that. But anyway, fish_right_prompt must be set up before the first prompt is shown for async-prompt to work correctly.

Does it fix the issue that defining fish_right_prompt in your config.fish?

PaulGrandperrin commented 2 years ago

It does indeed! I wasn't sure which script should be loaded first, the prompt script (like starship) or this, so I tried both orders in an interactive shell.

I think it would be nice to explicitly state in the doc that the order doesn't matter (based on my test) and that everything must be loaded before the first prompt to work correctly.

Anyway, thank a lot for this project, it makes starship useable in big git repos :)

fredericrous commented 2 years ago

solution for me was to put starship init fish | source before status is-interactive || exit in my config file ~/.config/fish/config.fish. I don't get why this is necessary