Search code examples
shellfish

fish shell: how to add a newline before existing prompt?


I'm happy with the default fish prompt, except I'd like to cause a newline to be printed before it, to give visual separation from the previous command.

Is there some way for me to define a new fish_prompt that prints a newline and then somehow defers to the function that was previously known as fish_prompt?


Solution

  • Copy the prompt to another name, then call it from a new prompt function:

    functions --copy fish_prompt fish_prompt_original
    function fish_prompt; echo; fish_prompt_original; end
    funcsave fish_prompt_original
    funcsave fish_prompt