I’m new to using Vim and have been tinkering it for a day or 2 now.
Now, I’m filling up and customizing my vimrc file.
I’m an avid Windows Powershell user and I prefer it more over the old command prompt.
Now, when everytime I try to open a file in vim. it opens the file from my C:\Users\
and not to the current directory I am on.
Say:
– When I open the powershell, I am on C:\Users\MDF
– Then I command: cd $env:www to go to my WWW wamp path for web development
– Now I am on C:\wamp\www ..
– But when I issue the command: vim ./index.php (same as no ./)
the file opened in vim is the index.php file present on my C:\Users\
Is there any way that I could solve this problem?
I’ve looked for solutions and have found “set autochdir” which makes possible to automatically set the current working directory.
But the solution only works for the plain old windows CMD and is not working on Powershell
Thanks!
Wew! I think I’ve found a mundane solution for this problem.
The real problem is in Powershell’s way of handling directories and environment.
Now to make things work:
– Use the $pwd magic variable which is the current directory in Powershell
So when you want to open a file say index.php (which is not in the %homepath% directory)
then just use this command:
vim $pwd/index.php
The idea is to open /