To achieve a two-line shell prompt I tried adding the following to "segment_data" for the shell configuration but it resulted in the triangle being placed on the next line.
"cwd": {
"after": "\n"
}
Result:

I can deduce some hacks to make it work, but here is another proposal: use
# Theme file
{
"segments": {
"above": [
{
"left": [
# First line left segments
],
"right": [
# First line right segments
]
},
{
# Same for second line
}
],
"left": [
# Usual last line segments
],
"right": [
# Usual last line right segments
]
}
}
(used YAML syntax to allow comments) where output will look like
First line left segments > < First line right segments
Second line left segments > < Second line right segments
Left segments > Typed text < Right segments
@Lokaltog, how does this feel?
It could work pretty well. I think a more elegant solution could be to just have segments be a list, and each item in the list is an object which represents a line with the usual left/right keys. What do you think? It may be less obvious how it works without reading the docs (I can imagine users seeing the list and thinking each item is a segment and not a line), but not sure if that would be a huge problem.
There are two reasons why I have it this way:
This way it would be better to somehow select last line, I prefer the above. We are still not having configuration proposed previously (don’t remember where) about reserving some width for typed text (neither we have working truncation in shells: because sides are computed separately). It would be natural if option for this only existed in a _special_ line and unnatural if it was valid only for last one.
†Unless we want to support multiline statusline patch that is created by some Japanese (AFAIR) vim user group.
By the way, there is a way to display prompt below cursor, though I guess there will be big problems with rendering (zsh also has a bunch of data like completion to display below prompt and it is needless to say you can easily write script that extends on more then one line).
You make a good point, I agree with your initial suggestion.
It seems like @treyhunner's solution for a separate line for the prompt no longer works. Here is the minimal configuration I used to test:
{
"default_module": "powerline.segments.common",
"segment_data": {
"cwd": {
"after": "\n$ "
}
},
"segments": {
"left": [
{
"name": "cwd"
}
]
}
}
Here is the result on the command line:

I do not understand why the control-J (^J) character is in there.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
On June 23, 2014 2:15:13 AM GMT+03:00, Chris Lasher [email protected] wrote:
It seems like @treyhunner's solution for a separate line for the prompt
no longer works. Here is the minimal configuration I used to test:{ "default_module": "powerline.segments.common", "segment_data": { "cwd": { "after": "\n$ " } }, "segments": { "left": [ { "name": "cwd" } ] } }Here is the result on the command line:
I do not understand why the control-J (^J) character is in there.
Reply to this email directly or view it on GitHub:
https://github.com/Lokaltog/powerline/issues/462#issuecomment-46794678
That solution was exploiting a bug that is no longer present. And you are wrong: CTRL-J character is not present there: control characters are not displayed in the terminal.
If you are asking why NL is replaced with '^J' then the answer is simple: because NL _is_ CTRL-J.
-----BEGIN PGP SIGNATURE-----
Version: APG v1.1.1
iQJNBAEBCgA3BQJTp1t/MBwfMDI7PjIgHTg6PjswOSAQOzU6QTA9NEA+MjhHIDxr
cC1wYXZAeWFuZGV4LnJ1PgAKCRBu+P2/AXZZIiQvD/9S6V8qIfzstsqTStAQrs4t
gSTaFepaQFy9dBxaGch313+hnfL575KocIwYcvfxKhLfqf6Dy7a+TLtto26DkYYw
lL7Clyjp5vGE6OdzxMQnNjaSpmWUiYYS8UM20pIu3Ejq7rmXAROIqkY7LCRRpbQi
2r7CQzlUQsdjeUz0I8csb5Q4vKDBLy8vTAzcPtcxU8aGHbMoTlHDbiWBkskCf5e8
mAyO2+Ij0Uarw9AhVyyUPNVwF5W9G01wCzmjsS6W6mAD3Tv/K6zeKJXtfhdWiOfi
YJmdi1qU4DiAKJ4/USRidAlm8bFfRUbstSzEwc5HoqyMwz9XD6j77IskOIvDjvqA
Qi/i9EFhge8s654FsJmCil1LOLqLc8bDGHvC7uipreozTj/UT5w6hKrf1iHDrv/d
t+kD2rOlX7tftp82RTvzugtPiFBWssOxogM58w5xjL5YOkCIFH6HmOqLnZ8Xui8z
A+qcyRuMKWRyqzSlTRTAlwYYRvFVOUbh3K2iPE0S87XU5Tgfy9iZusdkVTS9/rat
/eIajqk38VZ392fuY9dQAthC0RD6VJ5eqXf+RRNjyRtM1QAUEdMEWlEImf052HTU
zhQXHZVvwoMccSWP0vOA7kylmi0GouPai6vL1Vxs0/6h3BTdn2p5uuPV0vbwiRol
lX/QG9k137hs0hDJs/b7ng==
=AleT
-----END PGP SIGNATURE-----
That solution was exploiting a bug that is no longer present.
There is no mention of the bug or its side effect anywhere else in this issue. That's fine though. So what's the new way to tell Powerline's shell component, "break the line"?
I want to put my prompt on a separate line than the information in the Powerline segments, as described at http://agperson.com/entry/4081. How do I do this, if the newline in "after" is now considered a bug exploit?
And you are wrong: CTRL-J character is not present there: control characters are not displayed in the terminal.
Fine, Powerline displays a "caret followed by a capital J", not a literal "Control-J", in lieu of a newline character. Based on the existing documentation I had to find by web searches, one of which led me to here, "caret followed by a capital J" was not the expected behavior.
There is no mention of the bug or its side effect anywhere else in this issue. That's fine though. So what's the new way to tell Powerline's shell component, "break the line"?
If there was this issue would be closed. Currently there is no way to have multiline prompt.
@gotgenes Check out new multiline-prompt branch in git://github.com/ZyX-I/powerline.
Note: I was testing my branch with
{
"default_module": "powerline.segments.common",
"segment_data": {
"hostname": {
"before": "î‚¢ ",
"args": {
"only_if_ssh": true
}
},
"virtualenv": {
"before": "â“” "
},
"branch": {
"before": "î‚ "
}
},
"segments": {
"above": [
{
"left": [
{
"name": "cwd"
},
{
"type": "string",
"highlight_group": "cwd",
"draw_soft_divider": false,
"draw_hard_divider": false,
"width": "auto"
}
],
"right": [
{
"name": "user"
}
]
}
],
"left": [
{
"module": "powerline.segments.shell",
"name": "mode"
},
{
"name": "hostname"
},
{
"name": "user"
},
{
"name": "virtualenv"
},
{
"name": "cwd",
"args": {
"use_path_separator": true,
"ellipsis": "…",
"dir_limit_depth": 3
}
},
{
"module": "powerline.segments.shell",
"name": "jobnum"
}
],
"right": [
{
"module": "powerline.segments.shell",
"name": "last_pipe_status"
},
{
"name": "branch"
}
]
}
}
in ${XDG_CONFIG_HOME:-$HOME/.config}/powerline/themes/shell/default.json.
Why make "above" a special case; why not just make segments itself an array with objects containing "left" and/or "right"? Objects are rendered in order of appearance in the array as separate lines, from first to last.
Using your example above:
"segments": [
{
"left": [
{
"name": "cwd"
},
{
"type": "string",
"highlight_group": "cwd",
"draw_soft_divider": false,
"draw_hard_divider": false,
"width": "auto"
}
],
"right": [
{
"name": "user"
}
]
},
{
"left": [
{
"module": "powerline.segments.shell",
"name": "mode"
},
{
"name": "hostname"
},
{
"name": "user"
},
{
"name": "virtualenv"
},
{
"name": "cwd",
"args": {
"use_path_separator": true,
"ellipsis": "…",
"dir_limit_depth": 3
}
},
{
"module": "powerline.segments.shell",
"name": "jobnum"
}
],
"right": [
{
"module": "powerline.segments.shell",
"name": "last_pipe_status"
},
{
"name": "branch"
}
]
}
]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
On June 23, 2014 10:38:10 AM GMT+03:00, Chris Lasher [email protected] wrote:
What "above" being a special case, why not just make segments itself an
array with objects containing "left" and/or "right"? Objects are
rendered in order of appearance in the array as separate lines, from
first to last.
You should read this issue from top, your question was already answered.
Using your example above:
"segments": [ { "left": [ { "name": "cwd" }, { "type": "string", "highlight_group": "cwd", "draw_soft_divider": false, "draw_hard_divider": false, "width": "auto" } ], "right": [ { "name": "user" } ] }, { "left": [ { "module": "powerline.segments.shell", "name": "mode" }, { "name": "hostname" }, { "name": "user" }, { "name": "virtualenv" }, { "name": "cwd", "args": { "use_path_separator": true, "ellipsis": "…", "dir_limit_depth": 3 } }, { "module": "powerline.segments.shell", "name": "jobnum" } ], "right": [ { "module": "powerline.segments.shell", "name": "last_pipe_status" }, { "name": "branch" } ] } ]
Reply to this email directly or view it on GitHub:
https://github.com/Lokaltog/powerline/issues/462#issuecomment-46810514
-----BEGIN PGP SIGNATURE-----
Version: APG v1.1.1
iQJNBAEBCgA3BQJTp9p+MBwfMDI7PjIgHTg6PjswOSAQOzU6QTA9NEA+MjhHIDxr
cC1wYXZAeWFuZGV4LnJ1PgAKCRBu+P2/AXZZIr45EADM3dVGi1ryTRubE5c7SJmD
cvE4mSg/4TXTRPQcfCUxcIYN9fq8tF7FRSx9lWa7C3SJ/RIF6mBm0z1wQopx9CHo
UbjrMAW23JEXsJRMVyg8Jzmk5YKrUJMBa1W507y3DMw+6Vhm71Kw3yQKFsR/vNNG
6dW0dXpm22qXCSuT3aX+6ACWLjuHbGVrLEhbG4AF+jrakrO9M/6jbDPU97pkmh20
0TCcF177juhZ+ssaN2FZQ7NRGgdVg9VFw5eEisheQTVLiZ+YPUL3kF5k8PM+mEc/
gjLCGIdAEoAjGLbMx7DAqI4X1gJ57Z28vcLF4FzbOn2yCxhZg8X2gvG3TePx7vkd
3nWN67ct+FwnI5C5oIEF6vJuw1zBbMuyrizqHljXuHp3yRzUNBq3En6EnpkXnzXC
lY4pJ9/nKmSFSY0cj6gh94qND3/koWPoVmu4V0r3GFEzyWM1KtAo86dRUiIbG8BD
GjDucOqJrA//LrRavezhe4JXzH06z5cbZ3d0npydBd+E4USe/dxwNv8bbDdAnI2Q
5wiC1oXEUdEmXBz3HsSA6pQ+Kd2seOldAqZyz2oiJZB9Y+DoDaeyawAvRxNBS3xe
uBdLuAvjuo/XeSUxgue+wNcoWKtnNLJ4PVGJjMsFJwI6fOnRZZG1wAsuVzi77K2h
arcazcmqTjRAyel6sGuJtw==
=4r6h
-----END PGP SIGNATURE-----
Fair enough.
I've looked and looked, and can't for the life of me figure out how can I have this on 2 lines.
Can you please provide a small example ?
Thank you.
Most helpful comment
https://github.com/yongjhih/rc/blob/master/.config/powerline/themes/shell/default.json for example.