Intellij - Open directory of selected file in Cygwin

2

0

In Eclipse, I could use Easy Shell and have a command to open the directory of the selected file in Cygwin.

I wonder if it is possible for Intellij.

The best I could do so far is use Terminal plugin and open the "root directory" of the module, not the directory of the selected file.

If there is a way to add a new context menu item like "Show in Cygwin" similar to "Show in Explorer", that will be perfect.

Gerry

Posted 2015-07-14T10:23:03.253

Reputation: 81

Answers

2

Yes you can do that with Settings——Tools——External Tools——Add:

Program: your\path\to\cygwin\bin\mintty.exe
Parameters: /bin/env CHERE_INVOKING=1 /bin/bash --login
Working Directory: $FileDir$

Note to uncheck Open Console, and it's done.

Reference: ConEmu | Cygwin Startup Directory and IntelliJ IDEA 14.1.0 Help :: External Tools

Jesus, I can't post images and more than 2 links due to my low reputation, eww.


My tip for people who don't know how to run cygwin bash.exe nicely from Terminal:

  • Create file start-bash.bat with following code inside:

    @echo off
    set CHERE_INVOKING=1 & D:\cygwin\bin\bash.exe --login -i
    
  • Copy file path to Settings——Terminal——Shell path

Only in this way can you start bash.exe from project directory instead of $HOME. Since Shell path is hard-coded and too difficult to get hacked, I don't know how to specify a subdirectory, whatever.

Joshz

Posted 2015-07-14T10:23:03.253

Reputation: 141

Thanks Joshz. I use back Eclipse these days because Intellij gives me some weird maven error for my project. I will take a note of it and try it when I use Intellij again in future. Thank you for the tip! – Gerry – 2015-08-20T00:17:21.823