Skip to content

Instantly share code, notes, and snippets.

@harryhanYuhao
Created November 6, 2024 13:21
Show Gist options
  • Save harryhanYuhao/bead95ad148185c6fd69ec53b2b518f9 to your computer and use it in GitHub Desktop.
Save harryhanYuhao/bead95ad148185c6fd69ec53b2b518f9 to your computer and use it in GitHub Desktop.
windows powershell profile
# $PROFILE
# shall be named as $PROFILE
# check with echo $profile
New-Alias v nvim
New-Alias c clear
function pyvenv {
if (Test-Path .venv) {
Write-Host "Activating virtual environment"
# Activate the virtual environment
.\.venv\Scripts\Activate.ps1
Write-Host "To deactivate the virtual environment, run 'deactivate'"
} else {
Write-Host "Creating virtual environment"
python -m venv .venv
Write-Host "Activating virtual environment"
.\.venv\Scripts\Activate.ps1
Write-Host "To deactivate the virtual environment, run 'deactivate'"
}
}
function mkcd {
param (
[string]$dirName
)
# Create the new directory if it doesn't already exist
if (-not (Test-Path -Path $dirName)) {
New-Item -ItemType Directory -Path $dirName
}
# Change to the new directory
Set-Location -Path $dirName
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment