-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMicrosoft.PowerShell_profile.ps1
82 lines (67 loc) · 2.89 KB
/
Microsoft.PowerShell_profile.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
$Host.UI.RawUI.ForegroundColor = "Black"
$Host.UI.RawUI.BackgroundColor = "White"
(Get-Host).PrivateData.ErrorBackgroundColor = $Host.UI.RawUI.BackgroundColor
(Get-Host).PrivateData.WarningBackgroundColor = $Host.UI.RawUI.BackgroundColor
(Get-Host).PrivateData.DebugBackgroundColor = $Host.UI.RawUI.BackgroundColor
(Get-Host).PrivateData.VerboseBackgroundColor = $Host.UI.RawUI.BackgroundColor
(Get-Host).PrivateData.ProgressBackgroundColor = $Host.UI.RawUI.BackgroundColor
(Get-Host).PrivateData.ErrorForegroundColor = "DarkRed"
(Get-Host).PrivateData.WarningForegroundColor = "Black"
(Get-Host).PrivateData.DebugForegroundColor = "Black"
(Get-Host).PrivateData.VerboseForegroundColor = "Black"
(Get-Host).PrivateData.ProgressForegroundColor = "Black"
Set-PSReadlineOption -TokenKind Command -ForegroundColor DarkCyan
Set-PSReadlineOption -TokenKind Comment -ForegroundColor Gray
Set-PSReadlineOption -TokenKind String -ForegroundColor Magenta
Set-PSReadlineOption -TokenKind Number -ForegroundColor Magenta
Set-PSReadlineOption -TokenKind Parameter -ForegroundColor DarkGray
Set-PSReadlineOption -TokenKind Keyword -ForegroundColor DarkGreen
Set-PSReadlineOption -TokenKind Variable -ForegroundColor DarkMagenta
Set-PSReadlineOption -TokenKind Type -ForegroundColor Gray
Set-PSReadlineOption -TokenKind Member -ForegroundColor DarkMagenta
Clear-Host
Set-Alias subl "$env:Programfiles\Sublime Text 3\subl.exe" -option ReadOnly
Set-Alias cmake "$env:USERPROFILE\CMake\bin\cmake.exe" -option ReadOnly
Set-Alias cmake-gui "$env:USERPROFILE\CMake\bin\cmake-gui.exe" -option ReadOnly
$env:Path = "$env:USERPROFILE\TDM-GCC-64\bin;$env:Path"
$Script:TagList = @()
function setTitleTag {
$title = ""
foreach ($tag in $Script:TagList) {$title += "($tag) "}
$Host.UI.RawUI.WindowTitle = $title
}
function addTag {
Param(
[string]$tag
)
$Script:TagList += $tag
setTitleTag
}
function removeTag {
Param(
[string]$tag
)
$Script:TagList = @($Script:TagList | ? { $_ -notlike $tag })
setTitleTag
}
$Script:location = (Get-Location)
function prompt {
removeTag($Script:location)
$Script:location = (Get-Location)
addTag($Script:location)
[Environment]::CurrentDirectory = `
(Get-Location -PSProvider FileSystem).ProviderPath
$nestSymbol = ">" * $NestedPromptLevel
$stackSymbol = "/" * (Get-Location -Stack).Count
$nextCommandId = (Get-History -Count 1).Id + 1
Write-Host "[${nestSymbol}${nextCommandId}${stackSymbol}]" `
-ForegroundColor DarkRed -NoNewLine
$identity = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object Security.Principal.WindowsPrincipal `
-ArgumentList $identity
if ($principal.IsInRole(
[Security.Principal.WindowsBuiltInRole]::Administrator)) {
return ": "
}
return ": "
}