2

I'm familiar with modifying a Terminal prompt similar to this question: "Show only current directory name (not full path) on bash prompt" but I'm looking to only modify the Terminal prompt in Visual Studio code.

I'd like to be able to run:

export PS1='~/${PWD/*\//} '

Is there a way in Visual Studio Code I can modify specify a custom .bash_profile? I'm not finding anything from searching the site or

1 Answers1

1

Visual Studio Code offers multiple ways to pass custom information to the shell (detailed here):

  • Pass custom environment variables
  • Pass custom arguments on the command line

Using custom environment variables, you could set options that you check for in your custom .bashrc. You could then set appropriate options for running inside VS Code.

With custom arguments, you can indeed specify a different .bashrc-equivalent, like this:

bash --init-file /path/to/file

For example, your settings.json on Linux could look like this:

{
    "terminal.integrated.shellArgs.linux": ["--init-file", "~/.bashrc-vscode"]
}

Keep in mind that “Windows” or “Linux” does not refer to the shell type but the OS. So if you’re using Git Bash on Windows, it’s still terminal.integrated.shellArgs.windows.

user219095
  • 65,551