Skip to content

Commit b9ea58e

Browse files
authored
docs: Add Documentation of Shell Integration for Cygwin + Fish Setup (#138)
* docs(shell-integration): add Fish+Cygwin setup for VSCode - Document setup for Fish terminal in Cygwin within VS Code. - Provide step-by-step guide for shell integration. - Include workaround for VSCode terminal profile configuration. - Add visual aid for integration verification. * docs(shell-integration): update Fish+Cygwin setup instructions Fix grammar errors * docs(shell-integration): clarify fish terminal setup - Update shell integration instructions for clarity by referring manual installation above
1 parent f4f4c50 commit b9ea58e

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

docs/features/shell-integration.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,83 @@ For optimal shell integration with WSL, we recommend:
228228

229229
## Known Issues and Workarounds
230230

231+
### VS Code Shell Integration for Fish + Cygwin on Windows
232+
233+
For fellow Windows users running Fish terminal within a Cygwin environment, here's how VS Code's shell integration works:
234+
235+
1. **(Optional) Locate the Shell Integration Script:**
236+
Open your Fish terminal *within VS Code* and run the following command:
237+
```bash
238+
code --locate-shell-integration-path fish
239+
```
240+
This will output the path to the `shellIntegration.fish` script. Note down this path.
241+
242+
2. **Update Your Fish Configuration:**
243+
Edit your `config.fish` file (usually located at `~/.config/fish/config.fish` within your Cygwin home directory). Add the following line, preferably within an `if status is-interactive` block or at the very end of the file:
244+
245+
```fish
246+
# Example config.fish structure
247+
if status is-interactive
248+
# Your other interactive shell configurations...
249+
# automatic locate integration script:
250+
string match -q "$TERM_PROGRAM" "vscode"; and . (code --locate-shell-integration-path fish)
251+
252+
# Or if the above fails for you:
253+
# Source the VS Code shell integration script
254+
# IMPORTANT: Replace the example path below with the actual path you found in Step 1.
255+
# Make sure the path is in a format Cygwin can understand (e.g., using /cygdrive/c/...).
256+
# source "/cygdrive/c/Users/YourUser/.vscode/extensions/..../shellIntegration.fish"
257+
end
258+
```
259+
*Remember to replace the example path with the actual path from Step 1, correctly formatted for Cygwin.*
260+
261+
3. **Configure VS Code Terminal Profile:**
262+
Open your VS Code `settings.json` file (Ctrl+Shift+P -> "Preferences: Open User Settings (JSON)"). Update or add the Fish profile under `terminal.integrated.profiles.windows` like this:
263+
264+
```json
265+
{
266+
// ... other settings ...
267+
268+
"terminal.integrated.profiles.windows": {
269+
// ... other profiles ...
270+
271+
// Recommended: Use bash.exe to launch fish as a login shell
272+
"fish": {
273+
"path": "C:\\cygwin64\\bin\\bash.exe", // Or your Cygwin bash path
274+
"args": [
275+
"--login", // Ensures login scripts run (important for Cygwin environment)
276+
"-i", // Ensures bash runs interactively
277+
"-c",
278+
"exec fish" // Replace bash process with fish
279+
],
280+
"icon": "terminal-bash" // Optional: Use a recognizable icon
281+
}
282+
// Alternative (if the above fails): Launch fish directly
283+
"fish-direct": {
284+
"path": "C:\\cygwin64\\bin\\fish.exe", // Ensure this is in your Windows PATH or provide full path
285+
// Use 'options' here instead of 'args'; otherwise, you might encounter the error "terminal process terminated exit code 1".
286+
"options": ["-l", "-c"], // Example: login and interactive flags.
287+
"icon": "terminal-fish" // Optional: Use a fish icon
288+
}
289+
},
290+
291+
// Optional: Set fish as your default if desired
292+
// "terminal.integrated.defaultProfile.windows": "fish", // or "fish-direct" depending what you use.
293+
294+
// ... other settings ...
295+
}
296+
```
297+
*Note: Using `bash.exe --login -i -c "exec fish"` is often more reliable in Cygwin environments for ensuring the correct environment setup before `fish` starts. However, if that approach doesn't work, try the `fish-direct` profile configuration.*
298+
299+
4. **Restart VS Code:**
300+
Close and reopen Visual Studio Code completely to apply the changes.
301+
302+
5. **Verify:**
303+
Open a new Fish terminal in VS Code. The shell integration features (like command decorations, better command history navigation, etc.) should now be active. You can test basic functionality by running simple commands like `echo "Hello from integrated Fish!"`. <img src="/img/shell-integration/shell-integration-8.png" alt="Fish Cygwin Integration Example" width="600" />
304+
305+
This setup works reliably on Windows systems using Cygwin, Fish, and the Starship prompt, and should assist users with similar configurations.
306+
307+
231308
### Shell Integration Failures After VSCode 1.98
232309
233310
**Issue**: After VSCode updates beyond version 1.98, shell integration may fail with the error "VSCE output start escape sequence (]633;C or ]133;C) not received".
58.2 KB
Loading

0 commit comments

Comments
 (0)