Skip to content

Instantly share code, notes, and snippets.

@Gordin
Created June 19, 2020 14:36
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gordin/cb44429a25fd7d4d7ba73b970d68b5ab to your computer and use it in GitHub Desktop.
Save Gordin/cb44429a25fd7d4d7ba73b970d68b5ab to your computer and use it in GitHub Desktop.
Make Tab-Completion usable in WSL by removing Windows stuff from PATH
# If in WSL, remove all windows stuff from path, except Windows dir for explorer.exe
# This Speeds up Tab-completion A LOT. without this pressing TAB takes ~8.5 seconds, with this
# ~100ms. Change /mnt/\c\/ to something different if the Windows drive is mounted somewhere else...
C_DRIVE='/mnt/c'
if [ -d "$C_DRIVE" ]; then
export PATH=$(echo ${PATH} | \
awk -v RS=: -v ORS=: "/${C_DRIVE//\//\\/}/ {next} {print}" | sed 's/:*$//')
# Add C:\Windows back so you can do `explorer.exe .` to open an explorer at current directory
export PATH="$PATH:$C_DRIVE/Windows/"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment