Skip to content
CypherZealot edited this page Nov 19, 2019 · 4 revisions

Themes are JSON files that describe plugins and prompt customisations. The themes that come with pshazz are stored in the themes directory, and that's a good place to look for examples.

Prompt

E.g.:

"prompt": [
	[ "cyan",  "", "$dir " ],
	[ "red",   "", "$git_branch$git_dirty " ],
	[ "green", "", "`$" ]
]

This is an array of arrays. The inner array contains three items

[ "foreground color", "background color", "output text" ]

The colors are limited to console colors. These colors apply to the following output text. You can see what color names are available by running (in powershell):

[enum]::getvalues([consolecolor])

The output text can contain string literals or variables. See the Prompt variables page on the wiki for more information about what variables are supported. You can also use any variables available in your session, e.g. "$env:OS".

Plugins

E.g.:

"plugins": [ "git", "ssh", "z" ]

This line just says that we want to enable the git, ssh and z plugins. See the plugins directory to see what's available.

Special plugin variables

Aliases

Example:

"aliases": {
    "rm": [ "help", "man", "info" ],
    "add": {
        "help($name)": "get-help $name -detailed | less"
        "man": "help",
    }
}

The aliases plugin adds some sensible aliases and removes some questionable ones. Check the top of the aliases plugin to see what's added or removed.

You can also add or remove your own aliases. In the example above, I've removed the "help", "man", and "info" aliases. I've also added to aliases:

  • man is a simple alias to help
  • help is a function alias that takes a $name parameter, passes it to get-help with the -detailed flag, and then pipes the output through less.
Git
"git": {
    "prompt_dirty": "*"
}
  • prompt_dirty: a character or string to display when there are uncommitted changes in the working tree. This will be substituted in where the $git_dirty variable is used in the prompt output text.
dircolors

Example:

"dircolors": {
   "dirs": [
       [".*", "cyan", ""]
   ],
   "files": [
       ["(?ix).(7z|zip|tar|gz|rar|xz|bz2|bzip2)$",
           "darkcyan",   ""],
       ["(?ix).(exe|bat|cmd|py|pl|ps1|psm1|vbs|rb|reg|sh|zsh|bin)$",
           "darkgreen",  ""],
       ["(?ix).(doc|docx|pdf|ppt|pptx|xls|xlsx|mdb|mdf|ldf|odt|odf|odg|odm|ods|otg|otp|ott|oxt)$",
           "magenta",    ""],
       ["(?ix).(txt|cfg|conf|config|yml|ini|csv|log|json|odb|md)$",
           "darkyellow", ""],
       ["(?ix).(sln|csproj|sqlproj|proj|targets|ignore)$",
           "darkred",    ""],
       [".*",
           "darkgray",   ""]
   ]
}

The dircolors plugin colorizes the output of Get-ChildItem, often aliased as dir or ls. Like the prompt definition, the "dirs": [] and "files": [] arrays are nested nested arrays. The inner array contains three items.

[ "pattern", "background color", "foreground color" ]

lo

Clone this wiki locally