acomagu/fish-async-prompt

fish: Unknown command: fish_right_prompt

Opened this issue · 9 comments

Trying to install your plugin with fisher gives me this error:

❯ fisher --version
fisher, version 4.4.3
❯ fish --version
fish, version 3.7.0
❯ fisher install acomagu/fish-async-prompt
fisher install version 4.4.3
Fetching https://api.github.com/repos/acomagu/fish-async-prompt/tarball/HEAD
Installing acomagu/fish-async-prompt
           /Users/akshatpradhan/.config/fish/conf.d/__async_prompt.fish
Installed 1 plugin/s
fish: Unknown command: fish_right_prompt
fish: 
    fish_right_prompt | read -z prompt
    ^~~~~~~~~~~~~~~~^

@kalip2 What is your output of this command: functions -q fish_right_prompt

And could you provide your plugin list and config.fish?

@acomagu More output as you requested

❯ fisher install acomagu/fish-async-prompt
fisher install version 4.4.4
Fetching https://api.github.com/repos/acomagu/fish-async-prompt/tarball/HEAD
Installing acomagu/fish-async-prompt
           /Users/akshatpradhan/.config/fish/conf.d/__async_prompt.fish
Installed 1 plugin/s
fish: Unknown command: fish_right_prompt
fish: 
    fish_right_prompt | read -z prompt
    ^~~~~~~~~~~~~~~~^
❯ functions -q fish_right_prompt
functions: -q: unknown option
❯ fisher list
jorgebucaran/autopair.fish
meaningful-ooo/sponge
ilancosman/tide@v6
gazorby/fish-abbreviation-tips
patrickf1/fzf.fish
jamiesteven/fish-plugin-lsd
franciscolourenco/done
markcial/upto
oh-my-fish/plugin-pj
patrickf1/colored_man_pages.fish
otms61/fish-pet
joseluisq/gitnow@2.12.0
❯ bat -pp .config/fish/config.fish

if status is-interactive
  # Commands to run in interactive sessions can go here
  eval "$(/opt/homebrew/bin/brew shellenv)"
  set -gx EDITOR 'code --wait'
  set -gx VISUAL 'code --wait --new-window'
  set -gx PROJECT_PATHS ~/Code # for oh-my-fish/plugin-pj
  set fish_greeting
  set fzf_preview_dir_cmd lsd --all --color=always # for PatrickF1/fzf.fish
  thefuck --alias | source 
  zoxide init fish | source
  # op completion fish | source
  # rbenv init - | source
  # pyenv init - | source
end

The error probably occurs because your current setup and/or theme doesn't implement the right prompt.

I resolved this issue by explicitly setting the async functions to only use fish_prompt, overriding the default. You can do this by running the following command once in your shell, as shown in the README:

set -U async_prompt_functions fish_prompt

This command sets the universal variable async_prompt_functions to use only fish_prompt, which should prevent the error related to fish_right_prompt.

I also ran into this. If you're using starship, starship init fish | source might be in an if status is-interactive check. Moving it outside should fix it.

@LRNZ09 I think that doesn't match up with your explanation, because /usr/local/bin/starship init fish --print-full-init does have a fish_right_prompt function.

I think there might be a mix-up. I’m not using Starship or other themes for my Fish shell.

I know that Starship offers additional prompt configuration options, but my issue revolves around the standard Fish prompt and a few other plugins; this understanding led me to propose my solution.

I think there might be a mix-up. I’m not using Starship or other themes for my Fish shell.

I know that Starship offers additional prompt configuration options, but my issue revolves around the standard Fish prompt and a few other plugins; this understanding led me to propose my solution.

@LRNZ09 I understand that not everyone experiencing this issue is using Starship. But when I tried it with Starship, I ran into this issue, even though Starship sets fish_right_prompt.

So maybe this issue isn't as simple as "your current setup and/or theme doesn't implement the right prompt".

I think https://www.reddit.com/r/fishshell/comments/vnal1x/comment/ie656h7/ is the explanation here?

fish-async-prompt starts a new fish process to do stuff. If you have defined your fish_right_prompt only when fish is interactive, that would break.

Also make sure you've updated fish-async-prompt recently because it had an issue that had symptoms like this.

Probably the plugin will need some changes because, in your situation, having Starship loaded even when the shell is non-interactive seems unfit to me.

For instance, you may have it loaded with a fish shell script where a theme is not really necessary and might slow down the whole thing.