Created
June 19, 2020 14:36
-
-
Save Gordin/cb44429a25fd7d4d7ba73b970d68b5ab to your computer and use it in GitHub Desktop.
Make Tab-Completion usable in WSL by removing Windows stuff from PATH
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
# 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