Commit 804e4e2
Justin Su
·
2026-02-27 13:08:31 -0500 EST
parent 1e4e888
Use `env_var` module in Starship prompt snippet (#66)
1 files changed,
+9,
-10
+9,
-10
| ... | ... | @@ -144,7 +144,7 @@ POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS+=my_zmx_session | |
| 144 | 144 | ||
| 145 | 145 | [oh-my-posh](https://ohmyposh.dev) is a popular shell themeing and prompt engine. This code will display an icon and session name as part of the prompt if (and only if) you have zmx active: | |
| 146 | 146 | ||
| 147 | - | ``` | |
| 147 | + | ```toml | |
| 148 | 148 | [[blocks.segments]] | |
| 149 | 149 | template = '{{ if .Env.ZMX_SESSION }} {{ .Env.ZMX_SESSION }}{{ end }}' | |
| 150 | 150 | foreground = 'p:orange' |
| ... | ... | @@ -153,21 +153,20 @@ POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS+=my_zmx_session | |
| 153 | 153 | style = 'plain' | |
| 154 | 154 | ``` | |
| 155 | 155 | ||
| 156 | - | ### starship | |
| 156 | + | ### Starship | |
| 157 | 157 | ||
| 158 | - | [starship](https://starship.rs) is a popular shell themeing and prompt engine. This code will display the session name as part of the prompt if (and only if) you have zmx active: | |
| 158 | + | [Starship](https://starship.rs) is a popular shell themeing and prompt engine. This code will display an icon and session name as part of the prompt if (and only if) you have zmx active: | |
| 159 | 159 | ||
| 160 | - | ``` | |
| 160 | + | ```toml | |
| 161 | 161 | format = """ | |
| 162 | - | ${custom.zmx}\ | |
| 162 | + | ${env_var.ZMX_SESSION}\ | |
| 163 | 163 | ... | |
| 164 | 164 | """ | |
| 165 | 165 | ||
| 166 | - | ... | |
| 167 | - | ||
| 168 | - | [custom.zmx] | |
| 169 | - | command = 'echo "[${ZMX_SESSION}]"' | |
| 170 | - | when = 'test "${ZMX_SESSION}" != ""' | |
| 166 | + | [env_var.ZMX_SESSION] | |
| 167 | + | symbol = " " | |
| 168 | + | format = "[$symbol$env_value]($style) " | |
| 169 | + | description = "zmx session name" | |
| 171 | 170 | style = "bold magenta" | |
| 172 | 171 | ``` | |
| 173 | 172 |