mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-02-02 05:41:10 -08:00
2 KiB
2 KiB
id | title | sidebar_label |
---|---|---|
config-templates | Templates | Templates |
Every segment has a template
property to tweak the text that is displayed.
Under the hood, this uses go's text/template feature extended with sprig and
offers a few standard properties to work with.
Global properties
.Root
:boolean
- is the current user root/admin or not.PWD
:string
- the current working directory.Folder
:string
- the current working folder.Shell
:string
- the current shell name.UserName
:string
- the current user name.HostName
:string
- the host name.Env.VarName
:string
- Any environment variable whereVarName
is the environment variable name
Helper functions
- url: create a hyperlink to a website to open your default browser
{{ url .UpstreamIcon .UpstreamURL }}
(needs terminal support) - path: create a link to a folder to open your file explorer
{{ path .Path .Location }}
(needs terminal support) - secondsRound: round seconds to a time indication
{{ secondsRound 3600 }}
-> 1h - glob: exposes filepath.Glob as a boolean template function
{{ if glob "*.go" }}OK{{ else }}NOK{{ end }}
Text decoration
You can make use of the following syntax to decorate text:
<b>bold</b>
: rendersbold
as bold text<u>underline</u>
: rendersunderline
as underlined text<i>italic</i>
: rendersitalic
as italic text<s>strikethrough</s>
: rendersstrikethrough
as strikethrough text<d>dimmed</d>
: rendersdimmed
as dimmed text<f>blink</f>
: rendersblink
as blinking (flashing) text<r>reversed</r>
: rendersreversed
as reversed text
This can be used in templates and icons/text inside your config.