Created
November 6, 2024 13:21
-
-
Save harryhanYuhao/bead95ad148185c6fd69ec53b2b518f9 to your computer and use it in GitHub Desktop.
windows powershell profile
This file contains hidden or 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
# $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