Skip to content
PowerShell implementation of the pure prompt
C# PowerShell
Branch: master
Clone or download
Latest commit 1434742 Apr 12, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Libgit2sharp (#6) Mar 21, 2019
LICENSE Init Aug 9, 2018
publishme.ps1 Init Aug 9, 2018 Update Apr 10, 2019
screenshot.svg Libgit2sharp (#6) Mar 21, 2019


PowerShell implementation of the pure prompt.


  • Terminal with ANSI colour support (e.g. any modern version of Windows 10, ConEmu, Hyper, ansicon, etc.)
  • PSReadLine for async prompt updates. Works best with PSReadLine 2.0.


Set options on the $pure global.

Option Description Default value
PwdColor Colour of the current directory name.
BranchColor Colour of the current branch name.
RemoteColor Colour of remote status (up/down arrows).
ErrorColor Colour of error prompt and slow commands.
PromptColor Colour of the main prompt.
PromptChar Prompt character. (or on PSReadLine < 2.0)
UpChar Up arrow. (or on PSReadLine < 2.0)
DownChar Down arrow. (or on PSReadLine < 2.0)
SlowCommandTime Duration at which command is 'slow'. 00:05
FetchInterval Period at which to fetch from remotes. 05:00
BranchFormatter Customize format of git branch name. { $args }
PwdFormatter Customize format of working dir name. { param ($cwd) $cwd.Replace($HOME, '~') }
PrePrompt Customize the line above the prompt. { param ($cwd, $git, $slow) "`n$cwd $git $slow"`n }

To customise the formatting of the current git branch or working directory, provide a function that transforms a string parameter into a string output. For example, this truncates the branch name by underscore delimited segments:

$pure.BranchFormatter = {
     $args |% {
       @(((($_ -split '_' | select -First 3) -join '_') + '…'), $_)
     } | sort Length | select -First 1

Similarly, you can customise the entire upper line by providing a function that transforms three string parameters ($cwd, $git and $slow) into a string output. For example, to include your username before the directory info:

$pure.PrePrompt = {param ($cwd, $git, $slow) "`n$($pure._branchColor)$([Environment]::UserName) $cwd $git $slow`n"}

Or to put the entire prompt on one line, remove the `n at the end of the pre-prompt:

$pure.PrePrompt = {param ($cwd, $git, $slow) "`n$cwd $git $slow"}

Further customisations can be easily made, for example to color your username a unique color you can provide an ANSI escade code, as follows

myColours = @{ blue = "`e[38;5;31m" }

$pure.PrePrompt =
  {param ($cwd, $git, $slow) "`n$($$([Environment]::UserName) $cwd $git $slow"}

which colors the username deep sky blue 3.


Install from the gallery or clone this repository:

Install-Module pure-pwsh

and import it in your profile. If you use this with posh-git (recommended for its excellent command completion) then you'll probably want to import pure-pwsh first so that posh-git doesn't waste time configuring the prompt.

Import-Module pure-pwsh


The packaged dependencies are built for the Windows x64 platform. To build for an alternative platform, cd into the directory containing PurePwsh.csproj (i.e. $env:PSModulePath/pure-pwsh/[version]/pure-pwsh) and run:

dotnet publish -o bin -c Release -r [your-runtime] #

Not currently included

  • Does not display username and host for remote sessions
  • Does not set window title
  • No vi mode indicator

Consider raising an issue if you want any of the above.

You can’t perform that action at this time.