I have the following files to handle shell configuration:
#~/.bash_profile if [ -f ~/.bashrc ]; then source ~/.bashrc fi and
#~/.bashrc ... configure shell If I open VSCode from the command line using code, my .bashrc is loaded whenever I add a new instance of the integrated shell.
However if I open VSCode via its icon, only my .profile is loaded.
How can I ensure my .bashrc is loaded instead?
I've tried various settings for the terminal.integrated.shellArgs.osx setting without any luck.
Changing Default Command Line Shell Here, choose Select Default Profile. Then, select any other type of command line shell. Then, restart vs code and try working on terminal.
bashrc listed if you scroll down, but you can simply type in . bashrc , so it says /home/you/. bashrc . Then press Enter or click OK .
When VS Code launches for the first time, to source your "development environment," it launches your configured shell as a login shell, which runs your ~/.profile / ~/.bash_profile / ~/.zprofile scripts.
To everybody suggesting using .bashrc as a replacement for .bash_profile, it's important to distinguish between the two, as they are different: .bash_profile is executed at login. .bashrc is executed each time a bash instance is created, including sub-shells. Using .bashrc for such settings might cause errors and even be dangerous.
There is a hardcoded list of commands, which skip being processed by the shell and instead get sent to the VS Code keybinding system. Customize this list with the terminal.integrated.commandsToSkipShell setting.
Note: If you're having trouble launching your preferred shell in the integrated terminal, it may be due to your shell's configuration or a VS Code terminal setting. There's a dedicated troubleshooting guide to help you with these sorts of problems. The terminal tabs UI is on the right side of the terminal view.
Simply add shell arguments to the VsCode settings.json file.
Paths to the settings.json file are as follows:
Windows: C:\Users\<username>\AppData\Roaming\Code\User\settings.json` Linux: $HOME/.config/Code/User/settings.json Mac: $HOME/Library/Application\ Support/Code/User/settings.json Add one of the following:
"terminal.integrated.shellArgs.windows": ["-l"], "terminal.integrated.shellArgs.linux": ["-l"], "terminal.integrated.shellArgs.osx": ["-l"], This will launch your shell of choice with the login argument. This will thus execute any user profile that is setup.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With