]> us-delaporte.pagekite.me Git - dotfiles.git/blob - files/Microsoft.PowerShell_profile.ps1
Add functions for quick journal access
[dotfiles.git] / files / Microsoft.PowerShell_profile.ps1
1 $env:src = "$HOME\src"
2 $env:dotfiles = "$HOME\dotfiles"
3 Import-Module $env:dotfiles\psmodules\add_to_profile.psm1
4 Add-ToProfile $env:dotfiles\files\paths.ps1
5 Add-ToProfile $env:dotfiles\files\env.ps1
6
7 # Delay loading PoshGit for speed.
8 function Enable-PoshGit {
9 Import-Module posh-git
10 }
11 New-Alias pg Enable-PoshGit
12
13 Set-Alias code codium # Prefer Codium
14
15 # Dashboard
16 New-Alias dash Show-MyDashboard # from dash.psm1
17 New-Alias today Get-JournalAgenda
18 function journal {
19 param(
20 [switch]$limited = $false,
21 [switch]$shared = $false
22 )
23 $path = "$HOME\Box\Journal"
24 if($limited) {
25 $path = "$HOME\Box\SecDevLimited"
26 }
27 if($shared) {
28 $path = "$HOME\Box\Privacy & Cybersecurity\Cybersecurity Development"
29 }
30 nvim $path
31 }
32 function dotfiles {
33 nvim "$HOME\dotfiles"
34 }
35
36 # Vi
37 New-Alias vi nvim
38 New-Alias vim nvim
39
40 # You can pry my unix commands out of my cold dead fingers
41 if($iswindows) {
42 Set-Alias which get-command
43 }
44 # Reject Windows heritage, act like Vi
45 # Set-PSReadlineOption -HistorySavePath $env:src\PSHistory.log
46 Set-PSReadlineOption -BellStyle Visual
47 Set-PSReadlineOption -ViModeIndicator Prompt
48 Set-PSReadlineOption -EditMode Vi
49
50 Write-Host "+ Type 'pg' to enable PoshGit"
51 Write-Host 'See $env:realProfile for version controlled profile file.'
52
53 # Load dotfiles modules
54 $env:psmodules = "$env:dotfiles\psmodules"
55 Import-Module "$env:psmodules\dash.psm1"
56 Import-Module $env:psmodules\file_management.psm1
57 Import-Module "$env:psmodules\fix_vpn.psm1"
58
59 $maybe_mods = @(
60 "$env:src\travel-times\travel-times.psm1",
61 "$env:src\powershell-scripts\modules\AgileGitHubCLI.psm1"
62 )
63 $maybe_mods | ForEach-Object {
64 if(Test-Path $_) {
65 Import-Module $_
66 } else {
67 Write-Host "Not found: $_"
68 }
69 }
70
71 $env:nvim_config = "$HOME\AppData\Local\nvim"
72
73 # Load local source modules
74 # Import-Module $env:src\powershell-scripts\modules\MarkdownGitHub.psm1
75
76 # Let's face it, I'm about to cd into my source directory
77 if((Get-Location).Path -eq $HOME){ cd $env:src }