简体   繁体   中英

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 ?

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

Since fish does not have name spaces you cannot create two implementations of a function -- one of which calls the other. You will need to run funced fish_prompt , insert an echo or similar command at the appropriate point, then save it as a private version via funcsave fish_prompt .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM