diff --git a/.zsh_aliases b/.zsh_aliases index 1381c08..aeb6b1f 100644 --- a/.zsh_aliases +++ b/.zsh_aliases @@ -45,3 +45,21 @@ alias ip="ip -c" # IP command alias ports="ss -tulanp" # List all listening ports alias myip="curl ifconfig.me" # Get public IP address alias pingg="ping google.com" # Network Testing + +# WSL Specific +if grep -qEi "(Microsoft|WSL)" /proc/version &> /dev/null; then + # 1. Windows Explorer + alias winExp="/mnt/c/Windows/explorer.exe" + alias open="/mnt/c/Windows/explorer.exe" # Mac-style 'open' command + + # 2. VS Code (Dynamic Alias) + # This finds the username automatically so it works on any Windows machine + _WIN_USER=$(cmd.exe /c 'echo %USERNAME%' 2>/dev/null | tr -d '\r') + + if [ -d "/mnt/c/Users/$_WIN_USER/AppData/Local/Programs/Microsoft VS Code/bin" ]; then + alias code="/mnt/c/Users/$_WIN_USER/AppData/Local/Programs/Microsoft\ VS\ Code/bin/code" + elif [ -d "/mnt/c/Program Files/Microsoft VS Code/bin" ]; then + alias code="/mnt/c/Program\ Files/Microsoft\ VS\ Code/bin/code" + fi + +fi \ No newline at end of file diff --git a/.zshrc b/.zshrc index f331950..95cf967 100644 --- a/.zshrc +++ b/.zshrc @@ -54,21 +54,3 @@ eval "$(zoxide init --cmd cd zsh)" # Add to PATH export PATH="$HOME/.local/bin:$PATH" - -# --------------------------------------------------------------------- -# DYNAMIC VS CODE PATH (Run LAST) -# --------------------------------------------------------------------- - -# Get Windows Username -WIN_USER=$(cmd.exe /c 'echo %USERNAME%' 2>/dev/null | tr -d '\r') - -# Define potential paths (User Install vs System Install) -VSCODE_USER="/mnt/c/Users/$WIN_USER/AppData/Local/Programs/Microsoft VS Code/bin" -VSCODE_SYS="/mnt/c/Program Files/Microsoft VS Code/bin" - -# Add whichever exists to PATH -if [ -d "$VSCODE_USER" ]; then - export PATH="$PATH:$VSCODE_USER" -elif [ -d "$VSCODE_SYS" ]; then - export PATH="$PATH:$VSCODE_SYS" -fi \ No newline at end of file