Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Integrate babun shell in VS code

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?

like image 833
Sourav De Avatar asked May 22 '17 08:05

Sourav De


People also ask

What shell does VS Code use?

Visual studio code always uses the default bash terminal which can be, in my case for example, a little boring. To fully follow this post, you need to have zsh, oh-my-zsh and visual studio code installed.


2 Answers

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!

like image 133
Pramesh Bajracharya Avatar answered Nov 17 '22 08:11

Pramesh Bajracharya


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"
like image 21
TheSETJ Avatar answered Nov 17 '22 07:11

TheSETJ