4

When I open integrated terminal in VS Code, the initial screen showing "bash-3.2", see my screen shot

When I looked any online examples, it always showing current path or folder, such as the image in official page.

I was wondering how could I change the setting so that integrated terminal can show at least current folder that I am running the command. Please advise.

===updated====

I am sorry that I forgot to mention my OS is macOS sierra

Sean Lin
  • 43
  • 1
  • 4
  • Got the same problem. Did you figure it out? – Shawn Feb 12 '17 at 05:49
  • I had a similar problem but it was caused by a custom powershell profile that I had setup to `cd ~` due to running powershell as admin causing the current directly to default to system folder. Basically workarounds for the lack of sudo in powershell/cmd on windows. – jpierson Mar 06 '17 at 15:47

4 Answers4

3

Found the answer. You should add the following to settings.json:

"terminal.integrated.shellArgs.osx": ["-l"]

Restart VS Code to see it take effects.

Shawn
  • 2,675
  • 3
  • 25
  • 48
  • "This is deprecated, the new recommended way to configure your default shell is by creating a terminal profile in `#terminal.integrated.profiles.osx#` and setting its profile name as the default in `#terminal.integrated.defaultProfile.osx#`. This will currently take priority over the new profiles settings but that will change in the future." – Shanimal May 25 '21 at 16:30
  • EM! nope I've tried your way but it does not work! – scott Aug 08 '22 at 07:02
  • As others have noted, the syntax for this has changed. The new parameter to set is `terminal.integrated.profiles.osx`. If you type this into `settings.json`, it should autofill what the value should be, but if it doesn't, enter: `"terminal.integrated.profiles.osx": { "bash": { "path": "bash", "args": ["-l"], "icon": "terminal-bash"}, }` – mmarion Oct 19 '22 at 19:08
1

You need to setup/configure your bash shell separately to have a prompt with path, specifically the PS1 environment variable.

If you put the following in a file called .bashrc in your home folder, you should have a basic prompt with current path in every bash instance you start:

export PS1="\h:\w\\$ \[$(tput sgr0)\]"

There are thousands of variants for prompts, including colors, information about your source code repository, etc… So you might want to take some time looking the topic up.

kwood
  • 9,854
  • 2
  • 28
  • 32
  • Put that line into a .bash_profile under ~/ actually works! I wonder why I have to do this for integrated terminal of VS Code. With Mac's default terminal.app I don't have to add this step. – Shawn Feb 12 '17 at 23:35
0

Search for the current workspace directory setting named terminal.integrated.cwd in Workspace settings and ensure it is set to blank. Also ensure that there is no custom value set for it (in the right pane).

Similarly check User settings too.

Santanu Biswas
  • 4,699
  • 2
  • 22
  • 21
0

I was messing around with some keybindings and noticed that my terminal prompt had been replaced with just a '>'.

Entering the command 'cd' with no arguments fixed it.

No idea why. Don't care :)

Neutrino
  • 8,496
  • 4
  • 57
  • 83