VSCode terminal not showing current folder

痞子三分冷 提交于 2021-02-19 05:10:34

问题


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


回答1:


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

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

Restart VS Code to see it take effects.




回答2:


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.




回答3:


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.




回答4:


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 :)



来源:https://stackoverflow.com/questions/41929868/vscode-terminal-not-showing-current-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!