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
Open the Terminal tool window From the main menu, select View | Tool Windows | Terminal or press Alt+F12 .
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"
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.
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.)
There are 2 plugins (as far as I know):
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:
It opens terminal in the current folder. The plugin works out of the box, no additional settings are required.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With