]> apps.delaporte.us Git - dotfiles.git/blob - Microsoft.PowerShell_profile.ps1
theme colors
[dotfiles.git] / Microsoft.PowerShell_profile.ps1
1 # .EXAMPLE
2 # . C:\src\dotfiles\Microsoft.PowerShell_profile.ps1
3
4 # Courtesty of MKletz
5 # Get-ChildItem -Path 'C:\Repos' -Filter "*.psd1" -Recurse | ForEach-Object -Process {
6 # $Path = Split-Path -Path $_.Directory -Parent
7 # $env:PSModulePath = $env:PSModulePath + ";$($Path)"
8 #}
9 # $env:PSModulePath = $env:PSModulePath.Replace("\\ad.uillinois.edu\techsvc\home\$($ENV:USERNAME)\Documents\PowerShell\Modules;",'')
10
11 # No longer needed in PowerShell 7
12 if(-Not $IsWindows) {
13 # Bootstrap for older PowerShell
14 Write-Host "***Bootstrapped Is Windows for older PowerShell***"
15 $IsWindows = ($env:OS -eq "Windows_NT")
16 }
17
18 $env:src = "~\src"
19 if($IsWindows){
20 Write-Host "***Is Windows***"
21 $env:src = "c:\src"
22 }
23
24 if($IsWindows){
25 # Some Paths that are annoying to find/restore if the installer fails
26 $ENV:PATH+=";C:\Program Files\Microsoft VS Code\bin" # One Editor to rule them all
27 $ENV:PATH+=";C:\Program Files\Git\cmd" # Version control is nice.
28 $ENV:PATH+=";C:\ProgramData\chocolatey\bin" # Package management is nice.
29 $ENV:PATH+=";C:\bin\x16emu" # Package management is nice.
30 $ENV:PATH+=";C:\Program Files (x86)\GnuWin32\bin" # GNU Utils - i.e. rm
31 $ENV:PATH+=";C:\PENGUIN" # Flag to ensure my profile kicked in.
32 $ENV:PATH+=";$env:src\x16-demo\tools" # x16 python tools
33 }
34 else {
35 $ENV:PATH+=":$HOME/x16/x16-emulator" # x16 Emulator
36 $ENV:PATH+=":$HOME/src/x16-demo/tools" # x16 python tools
37 }
38 # alias renumber $HOME/src/x16-demo/
39
40 $env:Journal = "~\Journal\2021" # allows cd $env:journal
41 $env:minion = "$env:src\minion"
42
43 # Import some home grown PowerShell modules, if they are installed.
44 #
45 $modPaths = Get-Childitem -Path "$env:src\dotfiles\psmodules"
46 $modPaths += Get-Childitem -Path "$env:minion\psmodule"
47
48 # Windows Only Modules
49 if($IsWindows){
50 $modPaths += Get-Childitem -Path "$env:src\dotfiles\win_psmodules"
51 }
52 if($modPaths.length -eq 0){
53 Write-Host "No modules found."
54 }
55 $modPaths | ForEach-Object {
56 $fileName = $_.FullName
57 Import-Module $fileName
58 Write-Host ">> Loaded $fileName"
59 }
60
61
62
63 # Linux-like up/down in shell
64 Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
65 Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward
66 Set-PSReadlineOption -HistorySavePath $env:src\PSHistory.log
67
68 # Minion alias commands - 'today'
69 # . C:\src\minion\profiles\alias.ps1
70 . $env:minion\profiles\alias.ps1
71 # Add Minion go executable to path.
72 . $env:minion\profiles\path.ps1
73 # Add Minion to path
74 Write-Host "+ Added minion command to path."
75 if($IsWindows){
76 $ENV:PATH+=";$env:minion\go" # Flag to ensure my profile kicked in.
77 }
78
79 # Unix dies hard.
80 New-Alias which get-command
81
82 # Delay loading PoshGit for speed.
83 function Enable-PoshGit {
84 Import-Module posh-git
85 }
86 New-Alias pg Enable-PoshGit
87 Write-Host "+ Type 'pg' to enable PoshGit"
88
89 function Invoke-X16Emu {
90 param(
91 [string]$File
92 )
93 x16emu.exe -bas $File -keymap en-us
94 }
95
96 New-Alias x16 Invoke-X16Emu
97
98 if((Get-Location).Path -eq $HOME){
99 cd $env:src
100 }
101
102 function Get-GitLog() {
103 git log --oneline
104 }
105
106 function Get-GitStatus() {
107 git status -b --short
108 }
109
110 # Nice for git
111 New-Alias ol Get-GitLog
112 New-Alias st Get-GitStatus
113
114 # Dashboard
115 New-Alias dash Get-MyDashboard # from dash.psm1
116 New-Alias agenda Get-JournalAgenda # from minion_go.psm1