How to move out of auto-completed brackets in IntelliJ IDEA (without using the arrow keys)? - autocomplete

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!

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 - press Tab to jump out.
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

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.

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);

I went to preferences->Keymap and set a shortcut for "Move Caret to Line End" to Shift-Space. It takes me to the end of the current line I am on without adding anything, if that's what you want.

Not currently supported by Intellij. There is an open feature request on this at http://youtrack.jetbrains.com/issue/IDEA-74666. Extra votes would be nice.

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

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.

I set these setting:
1) I added Semicolon shortcut to Complete Current Statement:
Instead of using for loop command, I using fori command (because for command needs semicolon character):
2) I added Alt+Semicolon shortcut to Move Caret to Code Block End:
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.

Such key is called "End".
You can assign any unused shortcut to "Move Caret to Line End" action in "Settings/Preferences | Keymap".
P.S. You can use Ctrl+Shift+Enter to complete your statement (in your case it will place caret at the end of line and will add ";" there) -- action called "Complete Current Statement" and shortcut can be checked/changed in a same way as described earlier.

If you decide to move back to Eclipse and use PyDev this feature by default is disabled, First Switch to PyDev Perspective and you can enable it by going under Preferences>PyDev>Editor>Typing>Enable link on Automatic parenthesis or literals closing

Related

VS Code: jump to next occurrence of character x

In Vim, you can press fx and Fx to move to the next and previous occurrence of x on the same line:
**fx** - jump to next occurrence of character x
**Fx** - jump to previous occurence of character x
source: https://vim.rtorr.com/
I don't wish to use a vim emulator in VS Code, I instead would like to bind Ctrl+f to forward search and Ctrl+b for backwards search.
How can I do that?
I just posted an extension (I'm pretty sure you can't do it without an extension) that does what you want: Jump and Select
It does a little more than you want in case other people would like the selection option. You can bind any keybinding to the commands you want. The following demo uses Alt+f for forward and Alt+b for backward.
Note that the key you want to go to is not displayed. And you don't have to hit Enter to trigger the move - it just goes there immediately. And it works with multiple cursors.
Also, I am not familiar with vim. If you go back to some designated previous character, should the cursor end up before or after that character? Right now it goes to that character (so the cursor is after it) but it is easy for me to make to change that behaviour in the extension. Just let me know.
In VSCode, "find next" is performed by Ctrl+G (Cmd in MacOS) and "find previous" by Ctrl+Shift+G.
You can edit the keyboard shortcuts by going to Code > Preferences > Keyboard Shortcuts and looking for both "Find Next" and "Find Previous", and hovering over the keybinding to edit it to your preference.

Netbeans unindent (Shift+Tab) not working when cursor is inside the line (no selection)?

In Neatbeans, unindent works as expected when multiple lines are selected. But consider the following, where the pipe character | symbolizes the cursor position in the editor:
(a) Cursor at start of line (no selection)
|hello world!
(b) Cursor inside of line (no selection)
hell|o world!
In Netbeans, when I hit Shift+Tab on version (a) then the indentation is removed. This is what I expect.
However, when I hit Shift+Tab on version (b) then nothing happens. This is different from the code editors that I am used to. I would expect the indentation to be removed, or that the cursor moves to the start of the line, such that the next Shift+Tab will remove the indentation.
Is there a config in Netbeans that makes unindent via Shift+Tab work when the cursor is inside the line?
To shift the line to the left, regardless of the cursor position you can use the "Shift line left" editor action. In the default NetBeans mapping this is assigned to Alt+Shift+KP_LEFT and Alt+Shift-LEFT
Just open the keymap options page and search for the action "shift line"
It's not exactly what you are asking, but you could try to remap that action to "Shift-Tab" and see if it works.
TLDR: There seems to be a bug in the way NetBeans handles indenting/unindenting.
I would expect the indentation to be removed
I don't see any formal documentation on how unindenting is supposed to work in NetBeans, but it appears to move the text to the right of the cursor to the left, as long as there is only whitespace to the left of the cursor. While that is different to how unindenting works in other code editors such as Intellij IDEA and Eclipse, where the entire line is shifted to the left even when the cursor is poitioned within the text, it's not necessarily incorrect.
If you want to unindent in NetBeans there are two simple alternatives: either position the cursor at the start of the line, or select some text - anything at all! - on that line before unindenting.
Some comments in the NetBeans Bug Report Bug 212353 - Shift+Tab (Delete tab) shortcut does not work in editor may be relevant:
Please note that those actions should be inverse - I mean when you
select a block and you hit <TAB> <TAB> <Shift-TAB> <Shift-TAB> you
should always end up with the same text. The same should be true if
you change the order to <Shift-TAB> <Shift-TAB> <TAB> <TAB> you
should end up with the same text.
That said, NetBeans is not adhering to that standard. Using your second example, pressing <TAB><TAB> works fine, but subsequently pressing <SHIFT><TAB> does nothing, so it is not possible to "end up with the same text". That looks like a bug (in Apache NetBeans 11.2 at least). You can raise a bug report here.
It's also worth noting that <Shift> + <Tab> is actually defined as the keymap for "Delete TAB" rather "unindenting".
Is there a config in Netbeans that makes unindent via Shift+Tab work
when the cursor is inside the line?
I don't think so. All you can do, using Tools > Options > Keymap, is to change the shortcut keys from <Shift> + <Tab> to something else, but that won't change the behavior.

How to autocomplete curly braces and move cursor into it automatically in Eclipse?

I am new into Eclipse. I found that when I type Ctrl + ( it will also generate ) automatically, and move the cursor into this pair at the same time. After I finish editing coding in the pair, the cursor will jump out the parentheses automatically when typing Ctrl + ).
It's very convenient because I don't need to take a long distance movement to operate the arrow keys with my right hand every time. I also found [] also has this functionality. Unfortunately, I still don't find any combine-keys with {} to perform this functionally. Does anyone know about it?
First, look on Eclipse jump to closing brace.
Open in Eclipse Preferences from menu Window.
Navigate on left side to Java - Editor - Typing.
There is the option {Braces} in the group Automatically close. Check this option.
Also in Preferences navigate to General - Keys.
There is in the list the command Go to Matching Bracket with Editing Java Source in column When. You can redefine the key binding of this command.

Netbeans Keyboard Shortcut to Jump out of Quotations

I'm using Netbeans 7 and programming PHP. I was wondering if anyone knew of a keyboard shortcut to jump out of quotations marks and parenthesis (besides the right arrow key). For example I would like to type a quotation, type some text, then:
"my cursor would be here -> |"
Then hit tab or something equivalent to jump outside of the quotations:
"some text"| <- my cursor would now be here
Is this possible to accomplish using netbeans?
Type the second (end) quote. Netbeans realizes what's going on and does exactly what you describe.
you should take the auto quotation as a help to minimaze errors:
"The user often writes a code that has opening and closing brackets, and this is very often source of compilation errors. If the IDE would insert a closing bracket each time opening bracket is typed, the likelihood of error is smaller, and the user also has a better visualization of the structure."
source: https://ui.netbeans.org/docs/hi/promoB/smartBrackets.html
I was looking to a "short cut" myself to allow me to jump outside the quotation even when the cursor is not at the end of the content, but I could not find it.
Like me, you might find this method useful as well: select the text you want to wrap in quotes/brackets and the press the opening quotes/brackets you like: NetBeans will do it for you.
source: How to surround a text in quotes in netbeans IDE
code safe ;)

Pydev closing parenthesis autocomplete

Is there a shortcut to jump out of closing parenthesis in PyDev/Eclipse? Having to hit arrow key to move the cursor outside of the parenthesis is kind of a pain.
As Fabio said, you can jump out by pressing TAB or Enter, but this option is turned off by default and you simply get a few spaces/a new line upon pressing TAB/Enter.
To turn this precious option on, go to:
Window > Preferences > PyDev > Editor > Typing
and check "Enable link on automatic parenthesis or literals closing".
I just type the closing parenthesis and the editor gets me out without adding extra punctuation. Some would argue that this makes the auto placement of parenthesis somewhat redundant, but I find it quite useful
In the latest PyDev (2.0), it'll now create a link when it auto-closes the parenthesis, so, after it auto-closes you can press either ')', enter or tab to go to the other side (and remember that if you want to go to the next line directly, use shift+enter.