Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open a terminal via intellij in the selected folder

I want to right click on a file in intellij and open the terminal there in mac. I tried 'External Tools' but doesn't open the terminal in the selected directory even though I set $FileDir$ as the working directory of that tool

like image 942
Salil Surendran Avatar asked Jul 08 '15 07:07

Salil Surendran


People also ask

How do I open a terminal in IntelliJ?

Open the Terminal tool window From the main menu, select View | Tool Windows | Terminal or press Alt+F12 .

How do I navigate to a folder in IntelliJ terminal?

In "Settings -> Terminal", add the /K option followed by a command to navigate to the desired path, e.g.: Shell path: cmd /K "cd D:\usr\local\repo"

How do I open a folder in IntelliJ?

Right click on the folder corresponding to your context menu option, IntelliJ for me. Click on New , then Key . Type command . Click on the command folder you have created.


1 Answers

1. Out-of-the-box (no plugins)

Drag and drop a selected folder into the IntelliJ built-in Teminal opens a new terminal session in the built-in Terminal. (As @MariuszWróbel has written.)

2. With plugins:

There are 2 plugins (as far as I know):

  • Open Terminal Here
  • Open In Terminal

enter image description here

Both the plugins open an external terminal (outside of IntelliJ). Each of them adds some item(s) to the context menu of files and folders:

enter image description here

2a. Open Terminal Here plugin

It opens terminal in the current folder. The plugin works out of the box, no additional settings are required.

2b. Open In Terminal plugin

It does the same as the previous plus offers opening the terminal in the root folder of the module. The plugin does not work out of the box, you need to configure it as described here.

enter image description here

Linux:

Terminal command: gnome-terminal
Options: --working-directory

Windows:

Terminal command: cmd /C start cmd.exe /K
Options: cd /D

Windows (with babun or cygwin):

Terminal command: C:<USER-DIRECTORY>.babun\cygwin\bin\mintty.exe
Options: -i /Cygwin-Terminal.ico C:<USER-DIRECTORY>.babun\cygwin\bin\bash.exe -l -c "cd \"$0\" ; exec bash"

Mac OS:

Terminal command: open -a Terminal
like image 178
Honza Zidek Avatar answered Sep 26 '22 07:09

Honza Zidek