Skip to content

Commit a12f3f3

Browse files
authored
Add details on modifying the $EDITOR variable
1 parent a036d7e commit a12f3f3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/remote/troubleshooting.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,26 @@ For tips and questions about [GitHub Codespaces](https://github.com/features/cod
1717

1818
SSH is powerful and flexible, but this also adds some setup complexity. This section includes some tips and tricks for getting the Remote - SSH extension up and running in different environments.
1919

20+
### Configuring the $EDITOR variable
21+
22+
For macOS / linux remote hosts, add this snippet to your shell configuration file (like `.bashrc` or `.zshrc`)
23+
24+
```bash
25+
if [ "$VSCODE_INJECTION" = "1" ]; then
26+
export EDITOR="code --wait" # or 'code-insiders' if you're using VS Code Insiders
27+
fi
28+
```
29+
30+
For Windows hosts, here is the equivalent Powershell:
31+
32+
```pwsh
33+
if ($env:VSCODE_INJECTION -eq "1") {
34+
$env:EDITOR = "code --wait" # or 'code-insiders' for VS Code Insiders
35+
}
36+
```
37+
38+
Now running a terminal command that uses the $EDITOR variable, like `git commit`, will open the file in VS Code instead of the default terminal-based editor (like `vim` or `nano`).
39+
2040
### Configuring key based authentication
2141

2242
[SSH public key authentication](https://www.ssh.com/ssh/public-key-authentication) is a convenient, high security authentication method that combines a local "private" key with a "public" key that you associate with your user account on an SSH host. This section will walk you through how to generate these keys and add them to a host.

0 commit comments

Comments
 (0)