(powershell): Add powershell profile as template.

This commit is contained in:
Heavy 2024-07-05 11:17:19 +02:00
parent 6f9cc94181
commit dba0c78c6b

View File

@ -0,0 +1,40 @@
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\atomic.omp.json" | Invoke-Expression
function Get-LastN {
param (
[Parameter(Position=0)]
[int]$days = -7
)
Get-ChildItem -Path . -Recurse| ? {$_.LastWriteTime -gt (Get-Date).AddDays($days)}
}
# Using positional parameters
# See https://www.sharepointdiary.com/2021/02/powershell-function-parameters.html
function Net-Cat() {
param (
[Parameter(Position=0)]
[string]$computerName = "localhost",
[Parameter(Position=1)]
[int]$port = 22
)
Test-NetConnection -ComputerName $computerName -Port $port -InformationLevel Detailed
}
# Navigate one directory up
function Go-One-Level-Up {
cd ..
}
# Navigate two directories up
function Go-Two-Levels-Up {
cd ..
cd ..
}
# Set alias for navigation functions
Set-Alias .. Go-One-Level-Up
Set-Alias ... Go-Two-Levels-Up
# More Aliases
Set-Alias vi nvim
Set-Alias vim nvim