Reputation: 172
I switched from Windows to linux mint recently. This feature of opening terminal in cwd was working fine in windows. I also used sync to export all my settings to linux mint.
But for some reason, linux bash is not opening in cwd. Its been bugging me a lot and I don't know if it's an issue within my settings or an issue with VS code itself.
Upvotes: 0
Views: 386
Reputation: 32
As OP has noted, vscode is conflicting with bash's behaviour, but it is not necessary to give up your bash default cwd (current working directory).
Simply check whether the terminal is launched by vscode and based on that set the default cwd:
# ~/.bashrc
if [[ "$TERM_PROGRAM" != "vscode" ]]; then
cd /default-path
fi
now bash will have the /default-path
as its default cwd and vscode will keep its own project directory.
Upvotes: 0
Reputation: 172
Ok, I suspected that I had set a default directory for my linux bash so that whenever I opened a new terminal it would open in a default directory.
That was conflicting with VS code's default behaviour.
To fix :
open a new terminal and at root, run
$ code ~/.bashrc
search for your default directory
it looked like this:
$ cd directory-name
simply remove this line, save and close this file.
reload VS code and voila
Upvotes: 1