Skip to content

fish_config only copies fish_prompt function #736

Closed

Description

@aeosynth

osx 10.7.5, fish HEAD

after selecting the 'Robbyrussell' prompt from the fish_config web interface, the shell displays errors:

fish: Unknown command '_git_branch_name'
/Users/james/.config/fish/functions/fish_prompt.fish (line 2): _git_branch_name
                                                               ^
in command substitution
    called on line 11 of file '/Users/james/.config/fish/functions/fish_prompt.fish',

in function 'fish_prompt',
    called on standard input,

in command substitution
    called on standard input,

manually copy / pasting the displayed code into fish_prompt.fish works fine, as does using the 'Classic + Git' prompt

Activity

  1. sugar700 commented on May 12, 2013

    @sugar700
    Contributor

    The problem is that fish_config only copies fish_prompt. It's a bug.

  2. aeosynth commented on May 12, 2013

    @aeosynth
    ContributorAuthor

    edit: ok

  3. ridiculousfish commented on May 13, 2013

    @ridiculousfish
    Member

    The Classic+Git prompt doesn't throw errors immediately, but as far as I can tell its functions are not copied over successfully either. This is indeed a bug or limitation of the webconfig.py script: it propagates the fish_prompt function alone, not the entire file from which it came.

    For fish 2.0, I'm going to add an ugly hack to move the relevant function definitions inside fish_prompt, so they get copied over. For a future release we should teach webconfig.py how to copy over the file.

  4. ridiculousfish commented on May 13, 2013

    @ridiculousfish
    Member

    Ugly hack is 8befc47 . Leaving this open to track fixing it properly.

  5. changed the title [-]error with Robbyrussell prompt[/-] [+]fish_config only copies fish_prompt function[/+] on Oct 21, 2015
  6. added a commit that references this issue on Jan 7, 2019
  7. added a commit that references this issue on Jan 22, 2019
  8. jhdxr commented on Jan 26, 2021

    @jhdxr

    8 years passed, I'm wondering if this issue get addressed? Sorin uses fish_right_prompt and it seems still not working

  9. ridiculousfish commented on Jan 30, 2021

    @ridiculousfish
    Member

    This is not fixed properly; however as of b722e9a none of the sample prompts define function outside of fish_prompt, so it's worked around. That commit will be in 3.2.

  10. jhdxr commented on Jan 31, 2021

    @jhdxr

    @ridiculousfish Thanks. Just curious, is there any special reason that you always prefer these workarounds rather than modifying webconfig.py?

  11. ridiculousfish commented on Jan 31, 2021

    @ridiculousfish
    Member

    No, it's just easier. Modifying webconfig.py is the right approach but would have to duplicate some work done by funcsave, like fetching $__fish_config_dir and creating the functions directory. If you or anyone has the appetite for it then we'd love to merge a PR.

  12. modified the milestones: fish-future, fish 3.3.0 on Jun 2, 2021
  13. locked as resolved and limited conversation to collaborators on Jun 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions