setting the terminal default path to the current project path

Hi,

I would like to launch the terminal plugin from the current project path I am working on.

Any ideas?

 

Thanks in advance

0
13 comments

Not sure I follow you... the built-in terminal opens in a project root directory by default. You can alter this behavior by specifying a directory to start in in Settings | Tools | Terminal, Start directory

2

thanks, but there is still a problem.

I noticed that it states the right path under 'Start directory', but when I launch the terminal plugin when im already in my current project, it still starts from the default terminal path and not from the current project path

2

Do you have `cd` commands defined in your .bashrc, etc? what OS are you on, what do your terminal preferences look like?

1

Im using macOS.

I`ll try to explain myself better using an example. Lets say my default working directory in bash is /Users/Jeho and my project is located in /Users/Jeho/project. After opening my project on WebStorm, I would like the built-in terminal to open directly on /Users/Jeho/project and not /Users/Jeho (and then navigate to /Users/Jeho/project). Anyway to configure it in WebStorm?

thanks

0

Well... You can configure the directory to start in - it's Preferences | Tools | Terminal, Start directory. But it looks as if you have a cd command or some scripts in your shell configuration file that cause the shell to сhange directory to your home dir on opening. Please check your .bashrc,.bash_profile, etc.

2

On Windows be sure that you have not overridden the

Set-Location powershell cmd in your $PROFILE (powershell profile).
 
how check:
 
open powershell
 
issue command : code $PROFILE  (requires vscode installed) or notepad $PROFILE

 

1

I had a default path defined in my profile. What helped to have the correct folder in Pycharm without changing the path elsewhere was to set an environment variable `PYCHARM=1` in Settings | Tools | Terminal, Environment variables

and using a condition in my powershell profile:

`if ($null -eq $env:PYCHARM) { Set-Location ~\another_folder }`

0

in my .bashrc I have a cd for when I run bash outside Intellij. This overrides the Start directory default in IntelliJ. Is there a way around that?

0

No, as the terminal sources .bashrc

0

Well I do have a “start directory” setup as my HOME directory and now I can't change it back (if I clear the input it automatically gets set with my home directory). How to get back to the default behaviour? It's incredibly annoying! MacOS by the way.

0

In the terminal preferences, the Start directory field is set to your current project directory folder by default. What value would you like it to be re-set to? did you try choosing the corresponding folder manually using the file chooser (instead of clearing the field)?

0

I'm not sure what exact steps lead me there, but instead of the project I intended to open I had a *workspace* project for which the **start directory** defaulted to the home directory even when the prompt was cleared. When the project was reopened properly the problem has gone away. Thank you for your assistance!

0
Glad to hear it's solved, thanks for keeping us informed!
0

Please sign in to leave a comment.