Skip to content

Commit 0955e9c

Browse files
committed
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.
1 parent f6b05ae commit 0955e9c

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

docs/features/shell-integration.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,80 @@ 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 working:
234+
235+
1. **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+
250+
# Source the VS Code shell integration script
251+
# IMPORTANT: Replace the example path below with the actual path you found in Step 1.
252+
# Make sure the path is in a format Cygwin can understand (e.g., using /cygdrive/c/...).
253+
source "/cygdrive/c/Users/YourUser/.vscode/extensions/..../shellIntegration.fish"
254+
end
255+
```
256+
*Remember to replace the example path with the actual path from Step 1, correctly formatted for Cygwin.*
257+
258+
3. **Configure VS Code Terminal Profile:**
259+
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:
260+
261+
```json
262+
{
263+
// ... other settings ...
264+
265+
"terminal.integrated.profiles.windows": {
266+
// ... other profiles ...
267+
268+
// Recommended: Use bash.exe to launch fish as a login shell
269+
"fish": {
270+
"path": "C:\\cygwin64\\bin\\bash.exe", // Or your Cygwin bash path
271+
"args": [
272+
"--login", // Ensures login scripts run (important for Cygwin environment)
273+
"-i", // Ensures bash runs interactively
274+
"-c",
275+
"exec fish" // Replace bash process with fish
276+
],
277+
"icon": "terminal-bash" // Optional: Use a recognizable icon
278+
}
279+
// Alternative (if the above fails): Launch fish directly
280+
"fish": {
281+
"path": "C:\\cygwin64\\bin\\fish.exe", // Ensure this is in your Windows PATH or provide full path
282+
// It doesn't use 'args' but 'options' instead. Or you will get error terminal process terminated exit code 1
283+
"options": ["-l", "-c"], // Example: login and interactive flags.
284+
"icon": "terminal-fish" // Optional: Use a fish icon
285+
}
286+
},
287+
288+
// Optional: Set fish as your default if desired
289+
// "terminal.integrated.defaultProfile.windows": "fish",
290+
291+
// ... other settings ...
292+
}
293+
```
294+
*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. But if it doesn't work for you, try the second option to use fish directly*
295+
296+
4. **Restart VS Code:**
297+
Close and reopen Visual Studio Code completely to apply the changes.
298+
299+
5. **Verify:**
300+
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" />
301+
302+
This setup works reliably on my Windows system using Cygwin, Fish, and Starship prompt. Hope this helps others with similar configurations!
303+
304+
231305
### Shell Integration Failures After VSCode 1.98
232306
233307
**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)