Skip to content

Instantly share code, notes, and snippets.

@jluster
Created January 10, 2015 10:05
Show Gist options
  • Save jluster/b1a9dc2d41680cb69778 to your computer and use it in GitHub Desktop.
Save jluster/b1a9dc2d41680cb69778 to your computer and use it in GitHub Desktop.
Powershell Profile
if ($host.Name -eq 'ConsoleHost')
{
Import-Module PSReadline
Set-PSReadlineKeyHandler -Key Ctrl+a BeginningOfLine
Set-PSReadlineKeyHandler -Key Ctrl+k ForwardDeleteLine
Set-PSReadlineKeyHandler -Key Ctrl+e EndOfLine
}
function shorten-path([string] $path) {
$loc = $path.Replace($HOME, '~')
$loc = $loc -replace '^[^:]+::', ''
return ($loc -replace '\\(\.?)([^\\])[^\\]*(?=\\)','\$1$2')
}
function prompt {
# our theme
$cdelim = [ConsoleColor]::DarkCyan
$chost = [ConsoleColor]::Green
$cloc = [ConsoleColor]::Cyan
write-host "$([char]0x0A7) " -n -f $cloc
write-host ([net.dns]::GetHostName()) -n -f $chost
write-host ' {' -n -f $cdelim
write-host (shorten-path (pwd).Path) -n -f $cloc
write-host '}' -n -f $cdelim
return ' '
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment