diff --git a/docs/editor/terminal-shell-integration.md b/docs/editor/terminal-shell-integration.md index 85003f7a49..62069a3f52 100644 --- a/docs/editor/terminal-shell-integration.md +++ b/docs/editor/terminal-shell-integration.md @@ -27,65 +27,31 @@ This standard, easy way will not work for some advanced use cases like in sub-sh ### Manual installation -To manually install shell integration, the VS Code shell integration script needs to run during your shell's initialization. Where and how to do this depends on the shell and OS you're using. +To manually install shell integration, the VS Code shell integration script needs to run during your shell's initialization. Where and how to do this depends on the shell and OS you're using. When using manual install it's recommended to set `terminal.integrated.shellIntegration.enabled` to `false`, though not mandatory. -When using manual install it's recommended to set `terminal.integrated.shellIntegration.enabled` to `false`, though not mandatory. +#### bash -> ℹ️ The method for calling the script will be simplified in the future (see [vscode#153921](https://github.com/microsoft/vscode/issues/153921)) +Add the following to your `~/.bashrc` file. Run `code ~/.bashrc` in bash to open the file in VS Code. -#### Windows - -The script below contains `` which must be replaced by VS Code's installation directory. This defaults to: - -- User install: `$env:HOMEPATH\AppData\Local\Programs\Microsoft VS Code\` -- System install: `C:\Program Files\Microsoft VS Code` - -**pwsh** - - Add the following to your [PowerShell profile](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7.2), replacing `` with VS Code's installation directory. Run `code $Profile` in pwsh to open the file in VS Code. - - ```pwsh - if ($env:TERM_PROGRAM -eq "vscode") { - . "\resources\app\out\vs\workbench\contrib\terminal\browser\media\shellIntegration.ps1" - } - ``` - -#### Linux and macOS - -The script below contains `` which must be replaced by VS Code's installation directory. This defaults to: - -- Linux: Find by running `echo "$(readlink -f "$(which code)")../resources"` -- macOS: `/Applications/Visual\ Studio\ Code.app/Contents/Resources` - -**bash** - - Add the following to your `~/.bashrc` file, replacing `` with VS Code's installation directory. Run `code ~/.bashrc` in bash to open the file in VS Code. - - ```sh - if [ "$TERM_PROGRAM" == "vscode" ]; then - . /app/out/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh - fi - ``` +```sh +[[ "$TERM_PROGRAM" == "vscode" ]] && . "$(code --shell-integration bash)" +``` -**pwsh** +#### pwsh - Add the following to your [PowerShell profile](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7.2), replacing `` with VS Code's installation directory. Run `code $Profile` in pwsh to open the file in VS Code. +Add the following to your [PowerShell profile](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7.2). Run `code $Profile` in pwsh to open the file in VS Code. - ```pwsh - if ($env:TERM_PROGRAM -eq "vscode") { - . "/app/out/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1" - } - ``` +```pwsh +if ($env:TERM_PROGRAM -eq "vscode") { . "$(code --shell-integration pwsh)" } +``` -**zsh** +#### zsh - Add the following to your `~/.zshrc` file. Run `code ~/.zshrc` in bash to open the file in VS Code. +Add the following to your `~/.zshrc` file. Run `code ~/.zshrc` in bash to open the file in VS Code. - ```sh - if [[ "$TERM_PROGRAM" == "vscode" ]]; then - . /app/out/vs/workbench/contrib/terminal/browser/media/shellIntegration-rc.zsh - fi - ``` +```sh +[[ "$TERM_PROGRAM" == "vscode" ]] && . "$(code --shell-integration zsh)" +``` ## Features