How to stop Escape from Leaving Terminal 关注
I have an IntelliJ Ultimate 2019.1.1. The following behavior happens on both a Mac and on an Ubuntu box, and it's relatively new behavior; pretty sure it started with the very latest release in the last couple of weeks.
When I'm in the IntelliJ terminal window and I press the Escape key, focus goes to the editor. How can I stop this behavior? I want focus to stay in the terminal after I press Escape.
I've looked in Keymap and don't see any actions mapped to Esc, except Editor Actions -> Escape. And even if I remove that shortcut, the behavior still happens. Toggling the Override IDE shortcuts setting in Tools -> Terminal makes no difference either.
I have "set -o vi" in my .bash_profile, so I end up pressing Escape a lot in the terminal, and this behavior is really annoying.
We have a related issue, please follow https://youtrack.jetbrains.com/issue/IDEA-210461
Solution from https://youtrack.jetbrains.com/issue/IDEA-210461
Keybindings are IDE wide, so no need to change it for each project.
Initial solution (deprecated now):
To disable Escape switching from the Terminal tool window to the editor, do the following: "Help | Find Action..." on the main menu; Type "registry" and click "Registry..." found element; Find
terminal.escape.moves.focus.to.editorkey and disable it. (it's available since 2019.1.2)
I would like to make a note here, I guess the typical reason someone would use vim inside og IntelliJ is to edit the git commit message and not to do anything fancy in vim?
If I'm right, it's probably better to keep the ESC as a Intellij-global way to "get back out of anything", and just press ctrl-C, as this will get you out of edit mode, and then you can type :wq<enter>
If you are using vim for advanced editing inside a terminal inside Intellij then you may need to rethink your life choices.
I am not invoking vi/vim from a terminal inside IntelliJ.
What "set -o vi" does is allow you to use vi commands to edit your command line. The default for editing the command line is emacs keystrokes, which I've never learned.
For example, it makes it easy to retrieve something from your history and quickly edit it with vi keystrokes.
If you're familiar with vi and do a lot of work in the terminal outside of IntelliJ, I strongly recommend setting it -- except for the interaction with IntelliJ.
Sorry about this little misunderstanding. That sounds pretty useful, I will try it out!
Also, Lars Hartvigsen I often ssh to another computer from the JetBrains terminal. For a variety of reasons. And it is not unsual to invoke vim there. Also, I prefer using 'tig' to manage my git flow instead of using JetBrains built-in git flow. The JetBrains stuff is fine if I'm doing something moderately annoying, but if I'm doing something simple or something very complex, I want the command-line.
It is rather short-sighted of you to dismiss other people's workflows as "bad life choices."
Having ESC exit the terminal window greatly reduces its usefulness for me. I choose to remap it.