I want to dynamically add a segment based on the name of the current directory, here e.g., the abc
.
If the directory name is abc
, then I want to add a segment showing an icon, e.g., a house, between the git information and the blue success indicator.
How can this be achieved?
You can make use of the text segment and the following template:
{{ if contains .Folder \"abc\" }}icon{{ end }}
{
"type": "text",
"style": "plain",
"foreground": "#E06C75",
"template": " {{ if contains .Folder \"abc\" }}icon{{ end }} "
}