Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run cmder inside IntelliJ idea #282

Closed
justechn opened this Issue Oct 3, 2014 · 94 comments

Comments

Projects
None yet
@justechn
Copy link

justechn commented Oct 3, 2014

Currently I am running Git bash inside IntelliJ Idea (http://blog.codeleak.pl/2014/02/git-bash-in-intellij-idea-13-on-windows.html). I would like to use cmder but I need to know if I can do the same, and if so, what command line arguments do I need to supply?

@jirikrepl

This comment has been minimized.

Copy link

jirikrepl commented Feb 11, 2015

That would be be great for me too. If we could run cmder inside Idea as Terminal

@sayems

This comment has been minimized.

Copy link

sayems commented Mar 12, 2015

+1

@MartiUK

This comment has been minimized.

Copy link
Member

MartiUK commented Mar 12, 2015

You'll probably need to do something like this:

$CMDER_LOCATION\cmder\vendor\conemu-maximus5\ConEmu.exe /Icon "$CMDER_LOCATION\cmder\icons\cmder.ico" /Title Cmder /LoadCfgFile "$CMDER_LOCATION\cmder\config\ConEmu.xml"

OR

C:\Windows\system32\cmd.exe" /k "$CMDER_LOCATION\cmder\vendor\conemu-maximus5\..\init.bat

@codeengie

This comment has been minimized.

Copy link

codeengie commented Sep 17, 2015

+1

@DanielGGordon

This comment has been minimized.

Copy link

DanielGGordon commented Sep 18, 2015

Holy moly that'd be awesome!!!!

@nikrolls

This comment has been minimized.

Copy link

nikrolls commented Dec 9, 2015

I got it working!

It was pretty simple based on @MartiUK's suggestions above:

  1. Set an environment variable called CMDER_ROOT to your root Cmder folder (in my case C:\Program Files (x86)\Cmder). It seems to be important that this does not have quotes around it because they mess with concatenation in the init script.
    image
  2. In your IntelliJ terminal settings, use cmd.exe /k ""%CMDER_ROOT%\vendor\init.bat"" as the Shell path. The double-double-quotes are intentional, as they counteract the missing double quotes in the environment variable.
    image
  3. Et voilà!
    image
    Unfortunately the lambda symbol is not supported in IntelliJ yet, but everything else seems to be working fine.
@codeengie

This comment has been minimized.

Copy link

codeengie commented Dec 11, 2015

Awesome! Thank you for figuring this out. Props to @MartiUK and @nikrolls

@nateperry

This comment has been minimized.

Copy link

nateperry commented Dec 31, 2015

@nikrolls technique worked for me as well (Thanks!). The only requirement was that I needed to restart IntelliJ for it to work correctly after adjusting the settings. Simply hitting "Apply" and "OK" was not enough.

@codeengie

This comment has been minimized.

Copy link

codeengie commented Jan 6, 2016

IntelliJ 15.0.2 displays the lambda symbol.

@fflrichard

This comment has been minimized.

Copy link

fflrichard commented Jan 30, 2016

thank you very much @MartiUK @nikrolls

@BassOfLion

This comment has been minimized.

Copy link

BassOfLion commented Feb 5, 2016

Nice! Thanks @nikrolls

@DanielGGordon

This comment has been minimized.

Copy link

DanielGGordon commented Feb 5, 2016

What about opening mintty with git bash in Intellij? Can you specify the mintty task when doing this?

I have opened git bash in intellij, but the lambda symbol still shows up as ?

@martin-sweeny

This comment has been minimized.

Copy link

martin-sweeny commented Feb 18, 2016

When I try @nikrolls suggestion, I get "The system cannot find the path specified."

When I put %CMDER_ROOT% into a windows explorer address bar, it works. I put cmd.exe /k ""%CMDER_ROOT%\vendor\init.bat"" as my Shell path in PHPStorm. I start PHPStorm and get "The system cannot find the path specified."

2016-02-18 17_17_53-terminal - x2o-join-eval

@Campeadoris

This comment has been minimized.

Copy link

Campeadoris commented Feb 20, 2016

@martin-wiseweb Perhaps you forgot to restart ide. I had the same error in IntelliJ. It helped me.

@kuzarth

This comment has been minimized.

Copy link

kuzarth commented Mar 3, 2016

@nikrolls Thanks, man. It works.

@mdesign83

This comment has been minimized.

Copy link

mdesign83 commented Mar 15, 2016

Cmder in cmd.exe is a half success as i see...
The best way should be to use cmder in conemu, but it does not embed in PHPstorm currently:/

cmd_vs_conemu

If I missing some configuration or misunderstood something, please correct me.
Thx

@MartiUK

This comment has been minimized.

Copy link
Member

MartiUK commented Mar 15, 2016

@mdesign83 It isn't technically running cmder in IntelliJ, just the initialisation scripts that cmder uses.

@AcidHardcore

This comment has been minimized.

Copy link

AcidHardcore commented Apr 16, 2016

Thanks, it working for me

@brdegenars

This comment has been minimized.

Copy link

brdegenars commented May 2, 2016

I'm having trouble getting the lambda icon to come up in IntelliJ. Was there any special config or some command flag that needs to be passed to make this available in IntelliJ 2016.1?

@MIKAGMR

This comment has been minimized.

Copy link

MIKAGMR commented May 17, 2016

After the latest security update I have to use quotes for the cmd.exe part:

"cmd.exe" /k ""%CMDER_ROOT%\vendor\init.bat""
@michaeljohnbennett

This comment has been minimized.

Copy link

michaeljohnbennett commented May 17, 2016

I did something similar by wrapping the whole thing in a bat file and calling that, kind of achieved the same solution, no lamdba sign though 😢

@born2net

This comment has been minimized.

Copy link

born2net commented May 29, 2016

I get some odd env when I run the cmd.exe

capture

any ideas?

Sean

@kevin-ashton

This comment has been minimized.

Copy link

kevin-ashton commented May 31, 2016

@born2net I was getting the same issue, but resolved it by using the full cmder install opposed to the mini.

@born2net

This comment has been minimized.

Copy link

born2net commented May 31, 2016

mmm tried full version, having same issue :/
running:

"cmd.exe" /k "C:\cmder\vendor\init.bat""
@dschulten

This comment has been minimized.

Copy link

dschulten commented Jun 12, 2016

@born2net see #223, torresandres' solution - helped in my case on Windows 10

@born2net

This comment has been minimized.

Copy link

born2net commented Jun 12, 2016

tx @dschulten I see clink is from some foreign site, I am reluctant to use compiled exe due to hidden trojans :(
any other solution? tx for the reply....

@dschulten

This comment has been minimized.

Copy link

dschulten commented Jun 13, 2016

@born2net wait until cmder includes the latest clink executable :)

@longnlp

This comment has been minimized.

Copy link

longnlp commented Dec 29, 2017

@fuzz101010
would you try to add call command to call the init.bat to see if it works?
"cmd.exe" /k set ConEmuDir=""%CMDER_ROOT%\vendor\conemu-maximus5&&Call %CMDER_ROOT%\vendor\init.bat""

@holysky5

This comment has been minimized.

Copy link

holysky5 commented Jan 4, 2018

the font space has some issues

@DrPandalot

This comment has been minimized.

Copy link

DrPandalot commented Jan 4, 2018

I tried iLuffy suggestion ( thanks! ) but got : 'C:\Program' is not recognized as an internal or external command, ( under win10 / install is in "c:\Program Files". )

So I resolved it like this ( notice a pair of " is now around %CMDER_ROOT%.

"cmd.exe" /k set ConEmuDir=""%CMDER_ROOT%"\vendor\conemu-maximus5&&Call %CMDER_ROOT%\vendor\init.bat"
Hope this helps.

@em14Vito

This comment has been minimized.

Copy link

em14Vito commented Jan 18, 2018

Command "cmd.exe" /k "%CMDER_ROOT%\vendor\init.bat" can work. However, when I open terminal, the direction would not locate in my project. (It will locate in C;\user.) Anyone knows?

@AlanJui

This comment has been minimized.

Copy link

AlanJui commented Jan 19, 2018

@em14Vito
Please follow the solution provided from iLuffy. Change your command to:
"cmd.exe" /k set ConEmuDir=""%CMDER_ROOT%"\vendor\conemu-maximus5&&Call %CMDER_ROOT%\vendor\init.bat"

@em14Vito

This comment has been minimized.

Copy link

em14Vito commented Jan 22, 2018

It work well by using @AlanJui and @phs92 solutions. Thanks a lot 👏

@LambdaExpression

This comment has been minimized.

Copy link

LambdaExpression commented Jan 23, 2018

IntelliJ IDEA 2017.3 (Ultimate Edition)
JRE: 1.8.0_152-release-1024-b6 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
CMDER_ROOT=D:\Program Files\cmder

it not work

"C:\Windows\System32\cmd.exe" /k set ConEmuDir=""%CMDER_ROOT%\vendor\conemu-maximus5&&Call %CMDER_ROOT%\vendor\init.bat""

image

I edit “init.bak”

image

image

image

image

set CMDER_ROOT=D:\Program Files\cmder
set DL=%~d0
set LAST_CD=%cd%

%DL%
cd %LAST_CD%

"C:\Windows\System32\cmd.exe" /k "D:\Program Files\cmder\vendor\init.bat"
@blowsie

This comment has been minimized.

Copy link

blowsie commented Mar 8, 2018

@cambalamas I had an error when trying your solution

The string is missing the terminator: '.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString
@DRSDavidSoft

This comment has been minimized.

Copy link
Contributor

DRSDavidSoft commented Mar 14, 2018

@TheNexusDesigns

This comment has been minimized.

Copy link

TheNexusDesigns commented Mar 16, 2018

Hey, it works but any idea why it always opens not in the project folder because when I open the terminal it works with cmder but it's navigated in my windows user folder and not in my project location. http://prntscr.com/is6i7u help would be much appreciated.

@davidlav

This comment has been minimized.

Copy link

davidlav commented Apr 5, 2018

If your location of cmder isn't constantly changing, just put the absolute path to where ever you have it located and forget all that environment variable crap. This works perfectly well in Webstorm 2018.1.

image

@kentnek

This comment has been minimized.

Copy link

kentnek commented Apr 18, 2018

@TheNexusDesigns Ironically I found the perfect solution in the VSCode thread, that points Cmder to the correct project location:

First create a file intellij.bat in your Cmder installation folder, say C:\Dev\cmder\intellij.bat:

@echo off
SET CurrentWorkingDirectory=%CD%
SET CMDER_ROOT=C:\Dev\cmder\ 
CALL "%CMDER_ROOT%\vendor\init.bat"
CD /D %CurrentWorkingDirectory%

In IntelliJ > Settings > Tools > Terminals, fill the Shell path field with:

"cmd.exe" /K "C:/Dev/cmder/intellij.bat"

Note the forward slash /, works for me on Windows 10.

@DRSDavidSoft

This comment has been minimized.

Copy link
Contributor

DRSDavidSoft commented Apr 22, 2018

@kentnek This seems to be the same solution listed here:
#1267 (comment)

@kentnek

This comment has been minimized.

Copy link

kentnek commented Apr 22, 2018

@DRSDavidSoft it's a bit different, as this solution includes a CD command in the new .bat file, which makes sure that Cmder starts up in the project directory.

@DRSDavidSoft

This comment has been minimized.

Copy link
Contributor

DRSDavidSoft commented Apr 22, 2018

@kentnek Right, but this issue has been fixed in init.bat in recent versions of Cmder, so no CD should be required here. (Of course, I'd appreciate it if you could verify this with your own installation, just to be sure.)

@david-learner

This comment has been minimized.

Copy link

david-learner commented Apr 26, 2018

Windows10 64bit
Intellij IDEA - community

  1. add environment variables
    CMDER_ROOT
    c:\cmder
    176

  2. config terminal setting
    175
    "cmd.exe" /k "%CMDER_ROOT%\vendor\init.bat"

DONE!
174

@77cc33

This comment has been minimized.

Copy link

77cc33 commented May 9, 2018

Maybe this fix will help to someone, who has issues with PyCharm and virtualenv activation.

"cmd.exe" /k "%CMDER_ROOT%\vendor\init.bat&&%VIRTUAL_ENV%\Scripts\activate.bat"

I also commented this block in activate.bat - without commenting it cmder unix tools stopped to work

:: if defined _OLD_VIRTUAL_PATH (
::     set "PATH=%_OLD_VIRTUAL_PATH%"
:: ) else (
::     set "_OLD_VIRTUAL_PATH=%PATH%"
:: )
@hexus

This comment has been minimized.

Copy link

hexus commented May 10, 2018

I tried Ansicon, which works for a regular cmd.exe. cmder (ConEmu), however, blocks it from running.

When Ansicon is installed for cmd.exe and PhpStorm is using the recommended "cmd.exe" /K "%CMDER_ROOT%\vendor\init.bat", it just crashes.

Running Windows 7. I just really want to use Cmder and still see those colours from Composer, and any other PHP console app for that matter. I don't think it's possible though.

@NotFind

This comment has been minimized.

Copy link

NotFind commented May 22, 2018

@kentnek it works for win10
cmder\vendor\init.bat
add -
@echo off
SET CurrentWorkingDirectory=%CD%
:: Init Script for cmd.exe
:: Created as part of cmder project

CD /D %CurrentWorkingDirectory%
exit /b

::
:: sub-routines below here
::

pycharm
"cmd.exe" /k ""%CMDER_ROOT%\vendor\init.bat""

@shifoodew

This comment has been minimized.

Copy link

shifoodew commented Jun 6, 2018

Good day! is there a way how to fix this strange output in Phpstorm terminal? I'm using cmder.

λ php artisan tinker
?[34mPsy Shell v0.7.2 (PHP 7.0.13 ΓÇö cli) by Justin Hileman?[39m

$p= \App\Status::all()
=> ?[34;4mIlluminate\Database\Eloquent\Collection?[39;24m {#1731
?[34mall?[39m: [
?[34;4mApp\Status?[39;24m {#1732
?[34mid?[39m: ?[35m1?[39m,
?[34mstatus?[39m: "?[32mAdded?[39m",
?[34mdescription?[39m: "?[32mAdded to cart but not purchase yet?[39m",

@dcorriveau-omniscient

This comment has been minimized.

Copy link

dcorriveau-omniscient commented Jun 7, 2018

Side note, if you want to display debug information, for example if you use @debug in sass, you need to enable verbose mode.
The shell path should look like this:
"C:\Windows\System32\cmd.exe" /k set ConEmuDir=""%CMDER_ROOT%\vendor\conemu-maximus5&&Call %CMDER_ROOT%\vendor\init.bat"" verbose-output 1

@mbayrak78

This comment has been minimized.

Copy link

mbayrak78 commented Oct 2, 2018

This one worked for me:

"cmd.exe" /k set CMDER_ROOT=D:\Program Files\cmder&&set ConEmuDir=%CMDER_ROOT%\vendor\conemu-maximus5&&call "%CMDER_ROOT%\vendor\init.bat"

@Peter-Optiway

This comment has been minimized.

Copy link

Peter-Optiway commented Oct 30, 2018

How do i set what task to use?, when i use C:\Tools\Cmder\cmder_shell.bat i get CMD but my default in cmder/ConEmu is Fish (using msys2)

cmder_shell.bat:

@cmd.exe /k %0\..\vendor\init.bat
@motjuste

This comment has been minimized.

Copy link

motjuste commented Dec 3, 2018

@Peter-Optiway : I created a bash.bat with the following content and set the Shell path to"cmd.exe" /k "%CMDER_ROOT%\bash.bat":

@echo off
CALL cmd /c ""%CMDER_ROOT%\vendor\git-for-windows\bin\bash" --login -i"

I assume replacing the last line with the appropriate command from the relevant Task in Cmder (or ConEmu) settings will do the job, but I welcome any corrections!

@mathewjustin

This comment has been minimized.

Copy link

mathewjustin commented Jan 17, 2019

@david-learner That worked out for me in Windows 10 with an additional quotes

"cmd.exe" /k ""%CMDER_ROOT%\vendor\init.bat""

@beta-tank

This comment has been minimized.

Copy link

beta-tank commented Jan 18, 2019

Does anyone know how to use PowerShell Cmder task in JetBrains IDEs? Here is the instruction for VSCode https://github.com/cmderdev/cmder/wiki/Seamless-VS-Code-Integration#use-powershell-instead-of-cmdexe, but I didn't know how to pass this parameters to Rider terminal settings.

@InvenTorrey

This comment has been minimized.

Copy link

InvenTorrey commented Feb 21, 2019

Just as a heads up, I didn't have to use any hacks, environment variables, etc.... I just pointed the shell path to [cmder path]/vendor/git-for-windows/bin/bash.exe.

Everything seems to be working correctly and even the lambda shows up correctly

@ljosberinn

This comment has been minimized.

Copy link

ljosberinn commented Feb 24, 2019

can confirm @mathewjustin s way works with the CMDer mini version in 2019.1 EAP via
"cmd.exe" /k "C:\Program Files (x86)\cmder_mini\vendor\init.bat"

@kczelusniak

This comment has been minimized.

Copy link

kczelusniak commented Apr 10, 2019

@beta-tank, I use the following for PowerShell Cmder:

"pwsh.exe" -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command . 'C:\\tools\\cmdermini\\vendor\\profile.ps1'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.