Last active
December 12, 2019 02:06
-
-
Save gregmac/81a6c853d3992cdf95fca47bb1bb0b63 to your computer and use it in GitHub Desktop.
PowerShell Set-WindowTitle profile config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import posh-git (if installed via scoop) | |
$poshGitModule = "$HOME\scoop\apps\posh-git\current\posh-git.psd1"; | |
if (Test-Path $poshGitModule) { Import-Module $poshGitModule } | |
# msbuild convenience alias | |
Set-Alias MSBuild 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe' | |
# bash-style completion | |
Set-PSReadlineKeyHandler -Key Tab -Function Complete | |
#Set-PSReadlineOption -ShowToolTips | |
# set powershell window title | |
function Set-WindowTitle { $global:WindowTitleOverride = [string]::Join(" ",$args) } | |
Set-Alias -name "title" -value Set-WindowTitle | |
# override promt: set window title to current directory, | |
# unless Set-WindowTitle was used to override, | |
# or posh-git is installed and we're in a git directory. | |
function Prompt | |
{ | |
# Set WindowTitle to current directory name, unless overridden with Set-WindowTitle | |
$host.ui.RawUI.WindowTitle = if ($global:WindowTitleOverride) { $global:WindowTitleOverride } else { get-location }; | |
if ($GitPromptScriptBlock) { & $GitPromptScriptBlock } # posh-git compatibility | |
else { 'PS ' + $pwd + '> ' } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment