How to move out of auto-completed brackets in Inte

2019-01-07 04:51发布

I recently switched from Eclipse to Intellij Idea, and found myself wondering how to move the cursor out of a pair of auto-completed brackets. In eclipse after I finished typing in a pair of brackets, pressing tab brings me out of the brackets. How can I do the same thing without using the arrow keys?

Many thanks for your help!

10条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-01-07 04:58

You can do this by pressing the closing symbol that you would've pressed otherwise, but was auto completed. For example, if you have just typed the f below, you would press shift and 0 (or closing parenthesis), and it will move your cursor outside of the parenthesis.

String asdf = "hello world";
System.out.println(asdf);
查看更多
劳资没心,怎么记你
3楼-- · 2019-01-07 05:04

IDEA doesn't have such feature yet. The closest equivalent is the Complete Current Statement editor action (Ctrl+Shift+Enter).

UPDATE:

Initial implementation for this feature is available in 2018.2 EAP version. It works more like in MS Visual Studio - without visual indication of tab 'exit' position. For now, it should work in Java, SQL, Python and some other files. It will take some time for other languages to catch up - some language-specific code changes are required. The feature is disabled by default, you can enable it in Settings->Editor->General->Smart Keys->Jump outside closing bracket/quote with Tab.

查看更多
闹够了就滚
4楼-- · 2019-01-07 05:08

It's not quite what you're looking for, but you can type the character you are trying to move outside of (a closing paren, for example) and that should pop you outside of the auto-completed character.

Not ideal, but functional as far as I've tested it.

查看更多
干净又极端
5楼-- · 2019-01-07 05:16

Ctrl + Shift + Enter does not seem to work for me in IDEA 12.1.4, but I found the closest feature to what I was looking for was Shift + Enter. This completes the line, creates a new line below the current line and moves the cursor to it.

查看更多
一夜七次
6楼-- · 2019-01-07 05:16

I set these setting:

1) I added Semicolon shortcut to Complete Current Statement:

enter image description here

Instead of using for loop command, I using fori command (because for command needs semicolon character):

enter image description here

2) I added Alt+Semicolon shortcut to Move Caret to Code Block End:

enter image description here

So when I inside the loop, by pressing Alt+Semicolon jumping end of the bracket, by pressing Semicolon I jumping out the bracket subsequently.

by adding these shortcuts, the speed of coding will be faster.

查看更多
兄弟一词,经得起流年.
7楼-- · 2019-01-07 05:17

Intellij supports the ctrl+shift+m shortcut that jumps to the end of the block:

https://www.jetbrains.com/help/idea/2016.2/navigating-to-braces.html

查看更多
登录 后发表回答