Web development and Tech news Blog site. WEBISFREE.com

HOME > webdevetc

[IDE] How to use the esc key when editing files with vi or vim in the Intellij terminal

Last Modified : 26 Feb, 2023 / Created : 26 Feb, 2023
573
View Count
When using the web development editor Intellij (or WebStorm), you may sometimes need to use the vi or vim file editing feature in the terminal. In this case, you need to press the esc key to save changes while in insert mode. However, when you press the "esc" key in Intellij, it usually focuses out of the terminal, making it difficult to save by pressing :x or other commands. Here, we will learn how to keep the terminal active even when pressing the "esc" key.

Personally, I have had difficulty using the "esc" key when editing documents in the terminal, so I have often opened a separate terminal window to do my editing. But now, with this solution, that is no longer necessary.



! How to use the "esc" key in the Intellij terminal:


The reason why it's difficult to edit with the "esc" key in Intellij's terminal is that the default shortcut for "esc" is set to focus out. To solve this, we need to disable the shortcut.

Here is the solution. In summary, we need to go to the settings screen and disable the shortcut for the "esc" key. Follow these steps:


Disable Intellij terminal's "esc" shortcut

  • Go to the settings (configuration) screen - Ctrl + Alt + S
    In the left search field, type "terminal"
    Go to the Tools > Terminal section of the search results
    Click on the "Configure terminal keybindings" checkbox
    Select the "Escape" key that is set for "Switch Focus to Editor" and disable it
    Done!


Screenshot) Disable or modify the shortcut key set in step 4 above.

Now, when you press the esc key in the terminal, it will not focus out. This means that you can use the "esc" key to save changes in insert mode in vim that you run in the terminal.

That's it! We have learned a simple solution for using the esc key in the terminal.

Previous

How to Convert yarn.lock and package-lock.json Files to Each Other

Previous

[lodash] How to use get() method