I want the cursor to be on a new line
currently it is on the same line as the highlight line.
I have tried adding "newline" : true
, but it didn't work.
How can I resolve it ?
I'm pretty new to Oh My Posh installed on my Mac. I've found very little about what to do to add a \n
at the end of the prompt in the documentation. I've even tried what I've read in this dev.to powershell article by adding this block at the end of the json file...
...
{
"type": "prompt",
"alignment": "left",
"newline": true,
"segments": [
{
"type": "text",
"style": "plain",
"foreground": "#007ACC",
"properties": {
"prefix": "",
"text": "\uE602"
}
}
]
}
...
...but it didn't work for me. At best I can only get a "newline": true
with an empty line between executed commands, e.g.:
~/Downloads $
~/Downloads $
instead of the desired
~/Downloads
$
~/Downloads
$
SO!
Even if it might be the less elegant workaround I simply found any "trailing_diamond": "\ue0b4"
in the omp.json file and (by tries and errors) added to almost all them \n$
:
...
"trailing_diamond": "\ue0b4\n$ "
...
I stumbled upon a GitHub Issue comment by JanDeDobbeleer (owner of JanDeDobbeleer/oh-my-posh) which is something I'm pretty sure I hadn't found on the documentation, especially in the arguments listed in Type.
Adding a new block with just type
property and just newline
as argument works like a the charm 😉:
{
"type": "newline"
},
Despite what I thought, the last approach is now deprecated!
The solution would still be to use a block (first and last examples) as the last item in the blocks
array/list
{
"$schema": ... ,
...
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
...
]
},
{
...
},
{
"alignment": "left",
"newline": true,
"segments": [{
"foreground": "#007ACC",
"style": "plain",
"template": "\ue602 ",
"type": "text"
}],
"type": "prompt"
},
]
}