Last active
May 6, 2022 20:17
-
-
Save MIchaelMainer/ab631de5fef9dde4b24a92c9053d5573 to your computer and use it in GitHub Desktop.
PowerShell profile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# code $Profile | |
Import-Module posh-git | |
Import-Module oh-my-posh | |
Set-PoshPrompt -Theme powerlevel10k_lean | |
#Get-PoshThemes | |
# Set the default dir for PowerShell | |
Set-Location C:\repos | |
# gs = git status -v | |
function get-gitstatus { git status -v } | |
Set-Alias -Name gs -Value get-gitstatus | |
# opengh = Open the repo web URL | |
function open-webrepo { | |
$remo = git config --get remote.origin.url | |
start $remo | |
} | |
Set-Alias -Name opengh -Value open-webrepo | |
# profile = Edit profile with code. | |
function edit-profile { | |
code $profile | |
} | |
Set-Alias -Name PSprofile -Value edit-profile | |
# Chocolatey profile | |
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" | |
if (Test-Path($ChocolateyProfile)) { | |
Import-Module "$ChocolateyProfile" | |
} | |
function Touch-File() { | |
$fileName = $args[0] | |
# Check of the file exists | |
if (-not(Test-Path $fileName)) { | |
# It does not exist. Create it | |
New-Item -ItemType File -Name $fileName | |
notepad .\$fileName | |
} | |
else { | |
#It exists. Update the timestamp | |
(Get-ChildItem $fileName).LastWriteTime = Get-Date | |
} | |
} | |
### Create an alias for touch | |
# Check if the alias exists | |
if (-not(Test-Path -Path Alias:Touch)) { | |
New-Alias -Name Touch Touch-File -Force | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment