]> apps.delaporte.us Git - dotfiles.git/blob - Microsoft.PowerShell_profile.ps1
Tweaks
[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 if($IsWindows -eq "") {
12 # Bootstrap for older PowerShell
13 $IsWindows = ($env:OS -eq "Windows_NT")
14 }
15
16 #if($IsWindows){
17 # # Some Paths that are annoying to find/restore if the installer fails
18 # $ENV:PATH+=";C:\Program Files\Microsoft VS Code\bin" # One Editor to rule them all
19 # $ENV:PATH+=";C:\Program Files\Git\cmd" # Version control is nice.
20 # $ENV:PATH+=";C:\ProgramData\chocolatey\bin" # Package management is nice.
21 # $ENV:PATH+=";C:\PENGUIN" # Flag to ensure my profile kicked in.
22 #}
23
24 $env:Journal = "~\Journal\2021" # allows cd $env:journal
25
26 # Import some home grown PowerShell modules, if they are installed.
27 $modPaths = Get-Childitem -Path "c:\src\dotfiles\psmodules"
28 $modPaths += Get-Childitem -Path "c:\src\minion\psmodule"
29 if($modPaths.length -eq 0){
30 Write-Host "No modules found."
31 }
32 $modPaths | ForEach-Object {
33 $fileName = $_.FullName
34 Import-Module $fileName
35 Write-Host ">> Loaded $fileName"
36 }
37 #}
38 # $env:PSModulePath = $env:PSModulePath + ";c:\src\dotfiles\psmodules"
39
40
41 # Linux-like up/down in shell
42 Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
43 Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward
44 Set-PSReadlineOption -HistorySavePath c:\temp\PSHistory.log
45
46 # Minion alias commands - 'today'
47 . C:\src\minion\profiles\alias.ps1
48 # Add Minion to path
49 Write-Host "+ Added minion command to path."
50 $ENV:PATH+=";c:\src\minion\go" # Flag to ensure my profile kicked in.
51
52 # Unix dies hard.
53 New-Alias which get-command
54
55 # Delay loading PoshGit for speed.
56 function Enable-PoshGit {
57 Import-Module posh-git
58 }
59 New-Alias pg Enable-PoshGit
60 Write-Host "+ Type 'pg' to enable PoshGit"
61
62
63 if((Get-Location).Path -eq $HOME){
64 cd c:\src
65 }