To set up different Bash history files for each VSCode workspace, you can follow these steps:
-
Open your
settings.jsonfile in VSCode by clicking on the gear icon in the bottom left corner, then select "Preferences: Open User Settings". If it doesn't exist, create a new one. -
Add the following settings to your
settings.jsonfile:
{
"terminal.integrated.env.linux": {
"HISTFILE": "${workspaceFolder}/.bash_history_${workspaceName}"
},
"terminal.integrated.shell.linux": "/bin/bash"
}
-
Replace
"${workspaceFolder}/.bash_history_${workspaceName}"with the desired path for your Bash history file, including the workspace name in the file name. -
Save the file and restart VSCode.
Now, each time you open a new workspace, a new Bash history file will be created in the specified path. The Bash history file for the current workspace will be used when you open a terminal within that workspace.