Description
Code of Conduct
- I agree to follow this project's Code of Conduct
What would you like to see changed?
Currently I have my prompt set up like this:
This works fine for the most part except when windows are resized and spawn with a different size, as is the case often with tiling window managers.
In my config I have set the right-hand prompt to be a regular prompt with alignment: right
and this enables me to have the CWD as seen on the left on the same line as kubernetes and other information on the right.
I would like to switch to rprompt for the right-hand side, as this removes the issue about the prompt moving around like this:
How can you have transient prompt like in the first image, but have the rprompt be on the same line as the cwd-part? if I change the right-hand part to rprompt it is on the same line as the prompt itself no matter what I try to do with newlines etc:
Here is my config for reference:
$schema: "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json"
final_space: true
disable_notice: true
auto_upgrade: false
version: 2
blocks:
- alignment: left
type: prompt
segments:
- type: path
background: magenta
foreground: black
trailing_diamond:
leading_diamond:
style: diamond
#template: "{{ if .Writable }}{{else}}{{end}}<b>{{ .Path }}</b>"
template: "<b>{{ .Path }}</b>"
properties:
style: full
folder_format: "%s"
- type: git
background_templates:
- "{{ if or (.Working.Changed) (.Staging.Changed) }}lightYellow{{ end }}"
- "{{ if and (gt .Ahead 0) (gt .Behind 0) }}red{{ end }}"
- "{{ if gt .Ahead 0 }}blue{{ end }}"
- "{{ if gt .Behind 0 }}lightRed{{ end }}"
foreground_templates:
- "{{ if or (.Working.Changed) (.Staging.Changed) }}black{{ end }}"
- "{{ if and (gt .Ahead 0) (gt .Behind 0) }}black{{ end }}"
- "{{ if gt .Ahead 0 }}black{{ end }}"
background: green
foreground: black
style: powerline
powerline_symbol:
template: " {{ .UpstreamIcon }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }} {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }} {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} {{ .StashCount }}{{ end }} "
properties:
branch_icon: " "
cherry_pick_icon: " "
commit_icon: " "
fetch_status: true
fetch_upstream_icon: false
merge_icon: " "
no_commits_icon: " "
rebase_icon: " "
revert_icon: " "
tag_icon: " "
- type: session
style: diamond
leading_diamond:
trailing_diamond:
template: " {{ if .SSHSession }}{{ end }}{{ .UserName }} "
background: lightCyan
foreground: black
- type: prompt
alignment: right
# newline: true
segments:
- type: kubectl
background: lightBlue
foreground: black
leading_diamond:
trailing_diamond:
style: diamond
template: '{{ $context := splitList "/" .Context }}{{ index $context 0 }}'
- type: kubectl
background: cyan
foreground: black
leading_diamond:
trailing_diamond:
style: diamond
template: '<b>{{ $context := splitList "/" .Context }} {{$cluster:=regexReplaceAll "^api-os-" .Cluster "" }}{{ $leftMost := regexReplaceAll "-[^-]+-[^-]+:.*" $cluster "" }}{{ $leftMost }} </b>'
- type: kubectl
background: yellow
foreground: black
leading_diamond:
style: diamond
template: "{{ .Namespace }}"
trailing_diamond:
- type: prompt
alignment: left
newline: true
segments:
- background: transparent
foreground_templates:
- "{{if gt .Code 0}}red{{end}}"
- "{{if eq .Code 0}}lightBlue{{end}}"
style: plain
template: ❯
type: text
transient_prompt:
foreground_templates:
- "{{if gt .Code 0}}red{{end}}"
- "{{if eq .Code 0}}green{{end}}"
background: transparent
template: "❯ "
secondary_prompt:
foreground: lightBlue
background: transparent
template: "❯❯ "