How to Integrate babun shell in VS code
Asked Answered
A

3

7

I have tried changing the settings for "terminal.integrated.shell.windows" to babun mintty location. But the babun shell window opens separately and doesn't integrate with the VS code. Anyone knows how to achieve this?

Antitoxin answered 22/5, 2017 at 8:19 Comment(0)
V
10

After trying for 2 hours finally made it work.

Before reading my way of doing this, you might want to got through this issue first.

By default babun is installed in C:\Users\13000\.babun\. So we can configure it by overriding user setting in VS Code as:

"terminal.integrated.shell.windows": "C:\\Users\\YOURUSERNAME\\.babun\\cygwin\\bin\\zsh.exe",

After saving , reload the window and you are done.

You will get something like :enter image description here

Hope this helps!

Vergne answered 27/5, 2017 at 17:58 Comment(8)
The solution is not working I am receiving following error: The terminal process terminated with exit code: 3221225477Antitoxin
I got this to work, but with one weirdness: why is there a '%' above each prompt ? <BR/>% <BR/>{ ~ } » <BR/>~ % { ~ } » lSafe
Why does this site not allow comments to be edited after 5 min - and even then tell us only after we hit save ?? Just disable the darn edit button !Safe
Nm, fixed it from another post just use "unsetopt PROMPT_SP" superuser.com/questions/645599/…Safe
@PiKey by default directory being home you mean the path for shell when opened is home or install directory is home? :)Vergne
I mean like opening a terminal in VS Code, instead of being opened at project path it is always homeLipase
@Lipase oh, then that can be changed with "terminal.integrated.cwd": "", setting present under settings. For more information you can visit : code.visualstudio.com/docs/getstarted/settings . Good luck !Vergne
vs code marketplace.visualstudio.com/… worked great with babunLipase
U
4

I was searching for any solution for this issue before and I could not find any. But I was curious how Babun itself run the command "Open Babun here" from right-click menu and noticed it runs this command:

C:\Users\YOURUSER\.babun\cygwin\bin\mintty.exe /bin/env CHERE_INVOKING=1 /bin/zsh.exe

I've tried setting mintty.exe as shell and using leading commands as shell arguments, but this method opens an external terminal. I've noticed this behavior is because using mintty.exe, so I replaced mintty.exe with env.exe itself. At last, these are the settings:

"terminal.integrated.shell.windows": "C:\\Users\\YOURUSER\\.babun\\cygwin\\bin\\env.exe",
"terminal.integrated.shellArgs.windows": [
  "CHERE_INVOKING=1",
  "/bin/zsh.exe"
]

Edit: This might not completely relate to this question, but because of having the similarity, I think it might worth mentioning.

During my search for a solution, I've seen many other questions about the same issue for integrating Atom's PlatformIO IDE Terminal package or JetBrain's IDEs with Babun's zsh.

In the case of Atom, setting the Shell Override to C:\Users\YOURUSER\.babun\cygwin\bin\env.exe and Shell Arguments to CHERE_INVOKING=1 /bin/zsh.exe opens zsh.exe as an integrated terminal in the project directory.

In the case of JetBrain, I've used WebStrom and this works:

cmd.exe "/k C:\Users\ehsan\.babun\cygwin\bin\env.exe CHERE_INVOKING=1 /bin/zsh.exe"
Unbosom answered 7/8, 2018 at 18:55 Comment(2)
This is the best answer! Thanks a lot!Collagen
@Collagen I'm glad it helped. :)Unbosom
L
0

Just complementing the correct answer that Pramesh Bajracharya gave above, you can override user settings in VS Code opening the VS Code and going in:

File->Preferences->Settings

And then paste in the field shown in your right side (WORKSPACE SETTINGS):

{
    "terminal.integrated.shell.windows": "C:\\Users\\YOURUSER\\.babun\\cygwin\\bin\\zsh.exe"
}

More information can be found in https://code.visualstudio.com/docs/editor/integrated-terminal

Thanks Pramesh Bajracharya!

Lorrimor answered 10/8, 2017 at 2:26 Comment(2)
I'm glad this helped. Happy coding :)Vergne
How is this any different from what the accepted answer was ?Safe

© 2022 - 2024 — McMap. All rights reserved.