Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiline prompt in fish+tmux issues #2189

Open
thegcat opened this issue Dec 15, 2021 · 7 comments
Open

Multiline prompt in fish+tmux issues #2189

thegcat opened this issue Dec 15, 2021 · 7 comments

Comments

@thegcat
Copy link

thegcat commented Dec 15, 2021

I am trying to get a multiline prompt set up in fish in tmux. Unfortunately the "above" line doesn't seem to be aware of the width of the terminal and will just render the right segment directly after the left. See current shell theme and picture below.

Do I need to add some sort of spacer to get the "above" segment to be full-width?

{
  "segments": {
    "above": [
      {
        "left": [
          {
            "function": "powerline.segments.shell.mode"
          },
          {
            "function": "powerline.segments.common.net.hostname",
            "priority": 10
          },
          {
            "function": "powerline.segments.common.env.user",
            "priority": 30
          },
          {
            "function": "powerline.segments.common.env.virtualenv",
            "priority": 50
          },
          {
            "function": "powerline.segments.shell.cwd",
            "args": {
              "use_path_separator": true,
              "dir_limit_depth": ""
            },
            "priority": 10
          },
          {
            "function": "powerline.segments.shell.jobnum",
            "priority": 20
          }
        ],
        "right": [
          {
            "function": "powerline.segments.shell.last_pipe_status",
            "priority": 10
          },
          {
            "function": "powerline.segments.common.vcs.stash",
            "priority": 50
          },
          {
            "function": "powerline.segments.common.vcs.branch",
            "priority": 40
          }
        ]
      }
    ],
    "left": [
      {
        "type": "string",
        "contents": "",
        "width": 0,
        "highlight_groups": ["background"]
      }
    ],
    "right": []
  }
}

Bildschirmfoto 2021-12-15 um 18 35 42

@PH111P
Copy link
Member

PH111P commented Dec 15, 2021

I think that the fish binding is not currently supporting above lines; actually, I even think that fish doesn't really support above lines (might be wrong on that though).

@thegcat
Copy link
Author

thegcat commented Dec 15, 2021

There's some mentions of above stuff in the binding 😅 https://github.com/powerline/powerline/blob/develop/powerline/bindings/fish/powerline-setup.fish#L45

@thegcat
Copy link
Author

thegcat commented Dec 15, 2021

Regarding fish support for above lines, there's at least one fish theme offering 2-line prompts (not the default, but works well), so it's not a problem in fish it seems. https://github.com/oh-my-fish/theme-bobthefish

@thegcat
Copy link
Author

thegcat commented Dec 15, 2021

It seems the way to have multiline prompts in fish is to "just" output a prompt line with a \n https://github.com/IlanCosman/tide/blob/main/functions/_tide_prompt.fish#L2-L19

From what I can gather this is what Powerline already does, but the "above" line would need to be padded in the "middle" so as to fill the whole terminal width.

@thegcat
Copy link
Author

thegcat commented Dec 15, 2021

So, trying this out some more I noticed above lines just are the contents of the "left" and "right" segment groups jammed together. Adding an empty auto-spacer at the end of "left" and setting the fg and bg colors of that segment to match the bg of the "leftest" segment of the "right" group even hides its ending divider. This of course is a hack and will break of the "leftest" segment of the "right" group changes or changes its bg color.

Bildschirmfoto 2021-12-15 um 21 12 13

@thegcat
Copy link
Author

thegcat commented Dec 15, 2021

I forgot the example code for the spacer:

          {
            "width": "auto",
            "contents": "",
            "highlight_groups": [{ "fg": "gray2", "bg": "gray2" }],
            "type": "string"
          }

@thegcat
Copy link
Author

thegcat commented Dec 15, 2021

I guess what would be missing is to have spaces rendered between the left and right sides of individual lines (at least those rendered by render_above_lines) so that the line fills the whole terminal width. I'm not sure the existing code can do that currently, so I guess this is my feature request here 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants