Skip to content

Instantly share code, notes, and snippets.

@Gordin
Created June 19, 2020 14:36
Show Gist options
  • Select an option

  • Save Gordin/cb44429a25fd7d4d7ba73b970d68b5ab to your computer and use it in GitHub Desktop.

Select an option

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
@bbrootbeer
Copy link

this wored for me, know a trick, so that when i hit tab, that it list all available files or folders?

@bbrootbeer
Copy link

actually it didn't lol, there is numerous issues

@Gordin
Copy link
Author

Gordin commented Dec 21, 2025

My script is just to remove all unnecessary windows directories out of the PATH, so that the terminal doesn't try to search through them, when you autocomplete binaries.

fzf has a shell shortcut ctrl+t, that let's you fuzzy-select directories and files under cwd, maybe try that one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment