Lately I have been using the wsl
command to run Linux (Ubuntu) binaries and commands within powershell.
For instance:
ls | wsl grep 'log'
I was trying to use vim to open a file named .htaccess
but I didn't want to type the full name of the file. So instead I just typed wsl vim .ht
and pressed tab to have powershell autocomplete the path. This autocompleted to wsl vim .\.htaccess
which seemed fine but when I pressed enter, vim opened a new file named ..htaccess
(notice the additional period). That's when I realized that it was using the Windows' directory separator of backslash instead of forward slash. Presumably the backslash just escaped the period which is why in vim it was trying to create a new file named ..htaccess
.
I was wondering if there is any way to tweak powershell so that it uses forward slashes for path autocompletion instead of backslash. I know that lately Windows understands and translates forward slashes.
For example, this command works in powershell:
cd C:/Windows
Even though Windows uses backslash, this command worked and brought me to C:\Windows
. So is there a way to make autocompletion use forward slash?