Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ Terminal CTRL+C does not work

When using IntelliJs integrated terminal - for example with git - sometimes my CTRL + C keystrokes don't make to the terminal. For example the current line is not aborted.

What can I do as this behaviour is very annoying.

like image 772
GameScripting Avatar asked May 17 '18 10:05

GameScripting


People also ask

How do I use Ctrl C in terminal?

While in a command line such as MS-DOS, Linux, and Unix, Ctrl + C is used to send a SIGINT signal, which cancels or terminates the currently-running program. For example, if a script or program is frozen or stuck in an infinite loop, pressing Ctrl + C cancels that command and returns you to the command line.

How do I copy from terminal in IntelliJ?

Then click Command + A or Ctrl + A to select all the text and then click Cmnd + c or Ctrl + c to copy.

How do I enable terminal in IntelliJ?

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

How use IntelliJ command line?

Opening a Terminal Window We can open the terminal window with ⌥F12 on macOS, or Alt+F12 on Windows and Linux. The terminal supports all the same commands that the operating system supports. and press enter. When MongoDB is running in the terminal session, we can go back to writing the application code in the editor.

Is Ctrl-C (^C) not working in terminal?

Re: [Semi-Solved] Ctrl-C (^C) not working in terminal. Could the Ctlr+C key combination be mapped to something else in the WM? Can you try this from a different WM/DE or maybe even from one of the virtual consoles (Ctrl+Alt+F1) If Ctrl+C works in virtual console or any other WM/DE, then it could be an issue with Subtle WM..

Why doesn't my program stop when I press Ctrl+C?

It may depend a lot on whether the program is designed to be run in a terminal or from a GUI. Actually, many programs will not stop on Ctrl+C because all it does is create an exception in currently running thread. Multithread programs as well as programs with "In case of any exception, go on forward."

Will restarting a terminal program kill it?

I'm pretty sure it will kill most terminal programs; of course, it won't kill the ones that fork a new process, then return the prompt immediately. Some programs may catch this interrupt and handle it however they want, or even ignore it. It may depend a lot on whether the program is designed to be run in a terminal or from a GUI.

Does ideavim work with Ctrl+C and Ctrl+V on IDE?

I've also realised that if I install the IdeaVim plugin and on Settings > Other Settings > Vim Emulator I select Ctrl+C and Ctrl+V to be handled by the IDE then both work. But I don't want to work with this option cause it also changes many other shortcuts I'm too used to them to switch them.


1 Answers

As I had git for Windows installed anyway I just replaced the terminal used by IntelliJ from cmd.exe (which is the default on windows) to bash.exe supplied by git for Windows (which is cygwin btw)

To change it for all projects go to File >> Other Settings >> Default Settings and then Tools >> Terminal. (see screenshot)

In the shell path field set the following line:

"C:\Program Files\Git\bin\bash.exe" --login -i

Please make sure git is installed at the proper localtion or adjust the path (for example if you have the 32bit version of git installed)

screenshot of the windows to change the option

Using bash instead of cmd, the problem does not occour for me. Plus the bash supports some commands that cmd does not support, which is kinda nice when been used to a linux environment.

EDIT 2020-09-30: In latest Intellij versions the Terminal is a project-level setting and can be changed here:

new version is located under "new projects settings"

like image 124
GameScripting Avatar answered Sep 19 '22 22:09

GameScripting