Adds a new line before the every prompt, except when the prompt is the first line of the terminal.
Printing a new line before the prompt is a common practice to separate the prompt from the previous output. But did you ever notice that when you start with a clean shell, the first line of your terminal is not the prompt but an empty line? This plugin fixes that and only adds a new line before the prompt if it's not the first line of the terminal.
- π Add a new line before the prompt to separate it from the previous output
- β¨ Doesn't add a new line when the prompt is the first line of the terminal
- β
Keeps the
$statusof the last command intact - β¨οΈ Handles behaviors like
clearandCtrl + Lcorrectly - π Works with Starship
Using fisher:
fisher install niklasravnsborg/spaced-prompts.fishUpdate
fisher update niklasravnsborg/spaced-prompts.fishIf you use Starship as a prompt, add the following to your ~/.config/starship.toml:
# We don't need this, because `spaced-prompts.fish` will add the new line before the prompt if necessary
add_newline = falseAdd this to your ~/.config/fish/config.fish to make sure that the new line is added before the prompt, when you start a new shell.
# Init starship
starship init fish | source
# Add correct new lines for starship prompt
_spaced_promptsI only tested this with Starship so far, but it would be cool to get it working with other prompts as well. Pull requests are welcome!
There are some edge cases I discovered while developing this, that lead me to believe that this plugin might be more of a hack and ideally something like this could be implemented in fish itself.