#13007·fish-shell

FR: Configurable behavior for long prompt lines

Author: josephlou5Created Sep 21, 2026Updated Sep 26, 2026

I know this topic has been brought up before, but there doesn't seem to be an actual issue discussing wrapping long prompts (only drive-by comments in other issues that were resolved). I am not familiar with the exact intricacies of the prompt code, so please bear with me if I get some things incorrect.

Context

Related issues:

  • #904
  • #7706
  • #11341

Long prompts (exceeding $COLUMNS) used to be replaced by a basic > . In a2ae2d6c36147009bc565ca7ec8fc20340ac48b9, @ridiculousfish changed the logic to truncate each long line from the left instead, which helps keep part of the user's original prompt. https://github.com/fish-shell/fish-shell/issues/904#issuecomment-636498660:

The approach is that, for each line of the prompt whose width exceeds $COLUMNS, we prepend ellipsis and then start removing characters from the left until it fits, while skipping escape sequences. I chose the left because it probably has the least interesting information (e.g. parent directories).

#7706 and #11341 suggest that a solution to avoid truncation (or previously, replacement to > ) is to manually insert newlines in fish_prompt or to add logic to fish_prompt to handle different values of $COLUMNS and output the prompt accordingly.

From @lordlycastle in https://github.com/fish-shell/fish-shell/issues/7706#issuecomment-778550759:

I wish to add a global config variable and make this truncation optional. People with multi-line prompt might prefer to not clip the prompt. I know it messes up the right side prompt as it needs to be on new line (perhaps even n+1 line depending on overflow length on line n). I can't think of a solution to this ugly issue (maybe this flag only works when no right side prompt? this just adds more hidden "knowledge" complexity.)

From @faho in https://github.com/fish-shell/fish-shell/issues/7706#issuecomment-785879606:

If someone wants to make a case for our shortening still being inadequate, please file another issue and make your case. Especially explain how it should work - do lines just overflow? Where do we put the linebreaks then? What about the right prompt?

Personal context

Doesn't matter for the FR, but some personal motivation

I don't use any of the built-in fish_prompt stuff. I have spent extensive time writing my own custom prompt (not using any prompt libraries either), with all sorts of information that I might want, but still trying to keep it clean. In particular, I show things like the previous status(es), time, current VCS repo (or full path if not in a repo), possible virtual envs, last command duration, VCS info, etc. I also have a second line with a single character so that my commands are always aligned to the left. I used to use fish_right_prompt but not anymore (made copying commands annoying because it copies a bunch of spaces and I have to manually delete them where I pasted, such as in messages or comments).

My prompt is not usually long, but VCS info can make it so. I also usually have a wide terminal screen, but sometimes I'm working on my small laptop screen and have split the terminal vertically, which then triggers the prompt truncation logic. Personally, the left side of the prompt is much more important for me; the VCS info (at the end of the first line) is just there for convenience. However, I have so many moving parts and conditional segments in my prompt that writing manual logic over $COLUMNS feels tedious and troublesome. Therefore this FR, where I think the behavior for long prompt lines should be configurable rather than only truncating from the left, which as lordlycastle said might not be what all users want.

If this FR is closed as not planned, which is fine, then I'll spend some time fixing my prompt :) It's not a huge deal, though I do personally think that fish's prompt truncation behavior is unexpected, and is one of the very small downsides in an otherwise very good tool.

Feature request

I know this project usually prefers to avoid configurations. I've come around on this view as well, though it's sometimes hard for me because there are things I wish could be configurable, such as this :)

I could very well imagine that the left side of someone's prompt may be the least important (which motivated the original implementation to truncate starting from the left), but that is unfortunately not the case for me. So my immediate thought is to suggest a config somehow, which would enable users to choose how they want long prompt lines to behave, probably between "truncate left", "truncate right", "wrap", or whatever else might be reasonable. For my purposes, I'd accept "truncate right", but I think my ideal would be "wrap".

I think "truncate right" would be fairly trivial to implement, since it seems like it would just be "truncate left" but on the other side. The question then becomes "config option?", which I'm hoping a maintainer can weigh in on.

Currently, a long prompt line will cause fish_right_prompt to not be drawn, specifically if the cursor will overlap with it. Through some resizing testing, the cursor is allowed to start right where fish_right_prompt starts, but one column less will make the right prompt disappear. If the terminal screen is too narrow, then the last line is truncated from the left, and the cursor will end up on a new line. The same behavior makes sense for truncating on the right.

Wrapping

Another option would be to wrap long lines, which naively to me just means "don't do anything to long lines", so if line 1 is super long, then it wraps on the screen, and then there's a line break to start line 2. I don't know if there would be any problems with this until the last line of the prompt, which may conflict with fish_right_prompt (which is usually drawn aligned with the last line of the regular fish_prompt). There are potentially a couple options here:

fish
# Using these in following examples:

function fish_prompt
    echo 'my first line that is so very long'
    echo 'my second line that is also very long $ '
end

function fish_right_prompt
    echo RIGHT_PROMPT
end
  • Interrupt the last line of fish_prompt to draw fish_right_prompt, then continue the last line.

    Example
    assuming terminal edge is here:|
    my first line that is so very l
    ong
    my second line thatRIGHT_PROMPT
     is also very long $ <cursor>
    • This seems quite strange tbh, but just thought I'd mention it lol.
    • This might also be annoying / hard to calculate (if even possible).
  • Draw fish_right_prompt on the last wrapped line of the last line of fish_prompt.

    Example
    assuming terminal edge is here:|
    my first line that is so very l
    ong
    my second line that is also ver
    y long $ <cursor>  RIGHT_PROMPT
    • Might be annoying / hard to calculate?
  • Draw fish_right_prompt on a new line after the last line of fish_prompt.

    Example
    assuming terminal edge is here:|
    my first line that is so very l
    ong
    my second line that is also ver
    y long $ <cursor?>
                       RIGHT_PROMPT
    <cursor?>
    • I don't think this makes any sense, since the cursor is going to be at the end of the last line right? Or on a new line after fish_right_prompt? Both options seems strange.
  • Do not draw fish_right_prompt if the last line of fish_prompt is too long.

    Example
    assuming terminal edge is here:|
    my first line that is so very l
    ong
    my second line that is also ver
    y long $ <cursor>
    • This is perhaps similar in spirit to "truncate the left of each line because it's probably less important": fish_right_prompt is probably less important than the last line of the prompt (which may very well be the first and only line of the prompt), so it might be reasonable to just not show it.
    • This also matches existing behavior of what happens with truncated long lines: if the cursor might overlap fish_right_prompt, then it is not drawn at all.

Also, I guess someone might want to ask for "wrap at words" as well (so above would be my first line that is so very⏎long instead of wrapping at l⏎ong), but I personally don't think that's a very good idea because it starts adding a lot of complexity to what fish is going to do about a user's prompt. But if we got some sort of string wrap utility that breaks at words (which I notice that the built-in --help pages already do), then maybe it'd be a different story.