Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Visual Studio Code, how do you inject clink into the integrated terminal?

I was using clink with ConEmu for various node related tasks on windows, but now I'm trying Visual Studio code.

How do I inject clink into Visual Studio Code's integrated terminal, so that I can get real command history persistence between sessions, incremental history search, etc.?

With ConEmu I could inject clink by dropping the clink folder into a specified pickup directory.

I've tried using the path to the included clink bat file, and the clink exe in the VS Code setting terminal.integrated.shell.windows but these spawn and then close the command shell immediately.

Thanks!

like image 646
thinkOfaNumber Avatar asked Apr 12 '17 07:04

thinkOfaNumber


2 Answers

I discovered that you can pass arguments to the integrated shell in Visual Studio Code. Combined with the cmd.exe /K option which Carries out the command specified by string but remains, clink can be injected.

In VS Code, go to File > Preferences > Settings or use Ctrl , and add the settings:

"terminal.integrated.shell.windows": "C:\\WINDOWS\\sysnative\\cmd.exe",
"terminal.integrated.shellArgs.windows": ["/K", "C:\\path\\to\\clink\\clink_x64.exe inject"]

This is the equivalent of opening a command prompt in Windows, and running clink_x64 inject.

like image 109
thinkOfaNumber Avatar answered Oct 29 '22 12:10

thinkOfaNumber


It is not answer for your question, but there is another trick to see cmder and text editor in one window. You can open your text editor as another tab in cmder, which I described here:

https://medium.com/@WMorkowski/protip-integrating-cmder-with-text-editor-7f08a6e76de7

from article:

  1. Run your cmder.
  2. Go to ‘Settings -> Startup -> Environment’
  3. Type: set EDITOR_PATH=C:\Program Files (x86)\Microsoft VS Code\Code.exe alias editor="%EDITOR_PATH%" $1 -new_console:s50V Where in the first line you should type path to your text editor (I was testing it on Visual Studio Code and Sublime, but it should work with other editors).
  4. Save your settings
  5. Type ‘editor’ command in command line.

Whoa! We almost finished. But in most cases you don’t want console tab to be attached to the top of the window. You should close console tab, and open it again, paying attention to check “New console split to bottom” checkbox and choose the right console type. Now when you finally set everything up, you should go to ‘Settings -> Startup’, and check “Auto save/restore opened tabs” checkbox to save our new workflow. Now every time you run cmder, your tabs setup will be restored.

like image 29
WMorkowski Avatar answered Oct 29 '22 13:10

WMorkowski