Salil Surendran
Salil Surendran

Reputation: 2335

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

Upvotes: 26

Views: 20886

Answers (5)

bl4ckr0se
bl4ckr0se

Reputation: 624

For me it works this shortcuts by default in Intellij:

WIN: Alt+F12

MACOS: option+fn+F12.

Probably in MACOS you don't pay attention to fn to switch with F12 key

Upvotes: 0

In newer versions of Intellij, this seems to be integrated in the Terminal plugin, which is available by default.

You can either open a directory with your mouse by:

right click -> Open In -> Terminal

or assign a shortcut to the keymap command Plugins/Terminal/Open in Terminal.

Since creating a new terminal tab works with command + T, I've assigned command + option + T

Upvotes: 3

Honza Zidek
Honza Zidek

Reputation: 20346

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):

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

Upvotes: 26

bimeri noel
bimeri noel

Reputation: 189

just right click on the project folder that is being open in intelij, and select the option open in terminal

Upvotes: 1

Mariusz Wr&#243;bel
Mariusz Wr&#243;bel

Reputation: 261

You can just easily drag a selected folder and drop into terminal window.

Upvotes: 25

Related Questions