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 · 124 comments
Closed

Run cmder inside IntelliJ idea #282

justechn opened this issue Oct 3, 2014 · 124 comments

Comments

@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
Copy link

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

@MartiUK
Copy link
Member

MartiUK commented Mar 12, 2015

We have now an official guide to add Cmder to IntelliJ: 🎉

https://github.com/cmderdev/cmder/wiki/Seamless-IntelliJ-based-Integration

Cmder_IntelliJ

If you require further support, comment below. Please avoid using some outdated methods that were commented below.

@codeengie
Copy link

+1

@DanielGGordon
Copy link

Holy moly that'd be awesome!!!!

@nicole-ashley
Copy link

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
Copy link

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

@nateperry
Copy link

@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
Copy link

IntelliJ 15.0.2 displays the lambda symbol.

@fflrichard
Copy link

thank you very much @MartiUK @nikrolls

@BassOfLion
Copy link

Nice! Thanks @nikrolls

@DanielGGordon
Copy link

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
Copy link

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
Copy link

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

@ghost
Copy link

ghost commented Mar 3, 2016

@nikrolls Thanks, man. It works.

@mdesign83
Copy link

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
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
Copy link

Thanks, it working for me

@brdegenars
Copy link

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
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
Copy link

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
Copy link

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

capture

any ideas?

Sean

@kevin-ashton
Copy link

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

@born2net
Copy link

born2net commented May 31, 2016

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

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

@dschulten
Copy link

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

@born2net
Copy link

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
Copy link

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

@born2net
Copy link

ok tx! I haven't seen new builds from cmder in a while

@nate-vukovich
Copy link

nate-vukovich commented Dec 23, 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"

This also worked for me - tried everything else but this did the job. I'm using the Full version of Cmder.

@dschulten
Copy link

dschulten commented Mar 21, 2020

The instructions at https://github.com/cmderdev/cmder/wiki/Seamless-IntelliJ-based-Integration no longer work with 2020.1, you have to use the full path to cmder_shell.bat and put it in double quotes now. The expansion of %CMDER_ROOT% no longer seems to work.

"C:\Program Files\cmder\cmder_shell.bat"

No variable expansion with the classic solution either, now it has to be:

"cmd.exe" /k ""C:\Program Files\cmder\vendor\init.bat""

@prajoth89
Copy link

OR FOR POWERSHELL
"powershell" -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command . 'pathToCmder\Cmder\vendor\profile.ps1'

@director74
Copy link

Hello, all works
But how to change color theme of included cmder? from monokai to tomorrow theme. Because i use light theme in phpstorm

@daxgames
Copy link
Member

@lamoed in IntelliJ? There is no Cmder theme. Themes are a part of Conemu.

@director74
Copy link

@lamoed in IntelliJ? There is no Cmder theme. Themes are a part of Conemu.

Yes, if i writed cmd.exe /k ""%CMDER_ROOT%\vendor\init.bat"" maybe i could setup color scheme of conemu here?

@daxgames
Copy link
Member

But you are not running Conemu. 'init.bat' is the cmder init script. Normally by default it runs in Conemu but you are running Cmder inside IntelliJ. There is no theme unless the IntelliJ console is themeable.

@joberror
Copy link

joberror commented May 17, 2020

Hello, all works
But how to change color theme of included cmder? from monokai to tomorrow theme. Because i use light theme in phpstorm

@lamoed in IntelliJ? There is no Cmder theme. Themes are a part of Conemu.

But you are not running Conemu. 'init.bat' is the cmder init script. Normally by default it runs in Conemu but you are running Cmder inside IntelliJ. There is no theme unless the IntelliJ console is themeable.

  1. Download this plugin for your Jetbrains IDE: TERMINAL COLORS
  2. Get different Terminal color profile from this website --> https://terminal.sexy/
  3. You can also get configured iTerm2 color profiles here --> https://iterm2colorschemes.com/
  4. Follow the guidelines on how to set the terminal color through a color profile you downloaded
    -- see screenshot below on how to navigate

Screenshot: Terminal Colors setting

@daxgames
Copy link
Member

Themes are a part of Conemu. You are not using Conemu when integrated with IntelliJ Idea. Color of the shell would come from IntelliJ Idea I assume.

@joberror
Copy link

Themes are a part of Conemu. You are not using Conemu when integrated with IntelliJ Idea. Color of the shell would come from IntelliJ Idea I assume.

I just gave an example on how it is easy to get a theme configured (iTerm2 color profile) for the Conemu terminal in Jetbrains. Everything works perfectly if the guideline is being followed.

@Drprincerajput
Copy link

Drprincerajput commented Aug 10, 2020

when i run
CTRL + L
only lamda remain in terminal other part gone outside terminal window
is there any solution for that
one
two

problem when i will be playing with github.
can i tweak it like bash shell so everything will be in lamda line not above ?

@mtx-z
Copy link

mtx-z commented Aug 11, 2020

Tried this and had an error C:\Program is not recognized as an internal or external command operable program or batch file.
So I guess the "space" character in "Program Files" was messing with the script.

Following this SO post, I changed the CMDER_ROOT environment variable from: C:\Program Files\cmder to C:\PROGRA~1\cmder and it works :)

So full process for PHPStorm 2020.2 on windows:

  • install cmder
  • Create the environment variable CMDER_ROOT with the cmder path as the value
    • if you have the same issue as me, use C:\PROGRA~1\cmder instead of C:\Program Files\cmder, or C:\PROGRA~2\cmder instead of C:\Program Files (x86)\cmder
  • Edit PHPStorm settings Tools>Terminal>Shell path to cmd.exe /k ""%CMDER_ROOT%\vendor\init.bat""
  • restart PHPstorm

@daxgames
Copy link
Member

The Installation instructions recommend against putting Cmder in the C:\program files* folders. There is user specific config in Cmder and thus the best and recommended place for it is in a folder inside a users home folder.

@Lypheo
Copy link

Lypheo commented Nov 22, 2020

In case it helps anyone: I had to specify the full path to cmd.exe, like this:
"C:\Windows\System32\cmd.exe" /k "C:\cmder\vendor\init.bat"

@jp9573
Copy link

jp9573 commented Feb 24, 2021

With the following command, It starts Cmder in the terminal but not loading the aliases I set in the environment tab i.e. "gst".
cmd.exe /k ""C:\cmder\vendor\init.bat""

image

Any idea how can I use them in the IntelliJ terminal?

@chrisant996
Copy link
Contributor

chrisant996 commented Feb 24, 2021

@jp9573 Cmder is a bundle of products:

  • ConEmu, which is a terminal.
  • Clink, which adds some capabilities to CMD.
  • Various scripts, some from vendors and some part of Cmder itself.

It sounds like the intent here is to run Clink in a different terminal, but to also use some of the settings from ConEmu's UI to configure CMD.

ConEmu's UI configures ConEmu. So using a different terminal than ConEmu is not going to pick up the settings from ConEmu.

The Environment settings from the ConEmu UI are stored in config\user-ConEmu.xml which is part of ConEmu, not part of Clink or the Cmder scripts. The vendor\init.bat script configures Clink to know where to find the vendor scripts included with Cmder.

To configure this other terminal (IntelliJ?) I think you'll need to use the other terminal's configuration UI, and/or write some scripts.

However, there is also a config\user_aliases.cmd file which doesn't appear to have any ConEmu UI for editing it. If you put alias definitions in there, rather than in ConEmu's Environment settings, then the aliases will get defined in Clink inside ConEmu/Cmder, and also in Clink inside IntelliJ when using the vendor\init.bat file.

@maja42
Copy link

maja42 commented Feb 25, 2021

To start a bash terminal, I used cmd.exe /c "path\to\your\cmder\vendor\git-for-windows\bin\bash.exe"

@maja42
Copy link

maja42 commented Feb 25, 2021

To start a bash terminal AND get aliases like 'll' to work, I use cmd.exe /c "D:\Programme\cmder\vendor\git-for-windows\bin\bash.exe" --login -i

However, IntelliJ prints the following error everytime I open a terminal:

Creating user startup file: /config/user_profile.sh
cp: cannot stat '/vendor/user_profile.sh.default': No such file or directory

See my current question about that issue on SO: https://stackoverflow.com/q/66373669/2224996

@cdalexndr
Copy link

cdalexndr commented Jun 12, 2022

I have some color problems using light theme (console color scheme "IntelliJ Light") on Intellij 2022.1, Win11:
image

EDIT: solved it by manual configuration... #2516

@elisim
Copy link

elisim commented Jul 3, 2022

In Windows 11, PyCharm 2022.1.3, I used:

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

(reference @MIKAGMR answer)

And than I got a problem with the lambda icon. Fixed by:

In cmder\config\cmder_prompt_config.lua, changed the Prompt Element Colors to

-- Prompt Element Colors
uah_color = "\x1b[1;33;49m" -- Green = uah = [user]@[hostname]
cwd_color = "\x1b[1;32;49m" -- Yellow cwd = Current Working Directory
lamb_color = "\x1b[1;30;49m" -- Light Grey = Lambda Color
clean_color = "\x1b[1;37;49m"
dirty_color = "\x1b[33;3m"
conflict_color = "\x1b[31;1m"
unknown_color = "\x1b[37;1m" -- White = No VCS Status Branch Color

reference: @2516

@R0land013
Copy link

@Lypheo Thank you very much. That worked for me 💯 .

@bappelberg
Copy link

Simpel solution

  1. Create a file named cmder_shell.txt where your cmder folder is located (mine is located at C:\cmder)
  2. In cmder_shell.txt paste this command: @cmd.exe /k %0..\vendor\init.bat
  3. Save file as cmder_shell.bat
  4. Start Intellij
  5. File>Settings>Tools>Terminal>Shell path then enter paste C:\cmder\cmder_shell.bat
  6. Press "Apply" to the right bottom corner, then press "OK".
  7. Restart Intellij.
    Done.

@DRSDavidSoft
Copy link
Contributor

@bappelberg Note: The cmder_shell.cmd file already exists here: 📜 vendor/bin/cmder_shell.cmd

Please use that instead of creating your own, it's also more complete and is officially supported.

@alibutt30
Copy link

@DRSDavidSoft The cmder_shell.cmd file that you mentioned, doesn't works. The terminal opens and crashes in IntelliJ.
any hints on that ?

@DRSDavidSoft
Copy link
Contributor

@alibutt30 Can you please add the /d flag after the line that calls init.bat? Also change @echo off in the beginning to echo on.

This will turn the debugging on, so any issues are displayed. Please launch the terminal then either attach a screenshot of the what is causing the crash, or please copy and paste the log in a file and upload it here to we can investigate, thank you.

@alibutt30
Copy link

@DRSDavidSoft Apologies for the late response.
I took the logs. The terminal output the values in the file below and then just crashed. Therefore, I collected the output in a file.
Seems there is no error output.

Awaiting your analysis. Thank you

systeminfo.txt

@DRSDavidSoft
Copy link
Contributor

DRSDavidSoft commented Oct 23, 2023

@alibutt30 I moved our conversation to the link below to avoid generation a notification for everyone:
#2885

Remember, the official guide (tested and works) is here:
https://github.com/cmderdev/cmder/wiki/Seamless-IntelliJ-based-Integration

@cmderdev cmderdev deleted a comment from sayems Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests