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 ;)
Related
I want to surround the selected text with quotes or parentheses when I hit the corresponding button, not to overwrite it, which is the behavior I have observed. From what I have read so far, this is how the program usually behaves, but definitely not my case. I could not find the equivalent setting under Tools > Options. I have found the macros to surround a single word, but I want the whole selection, as would be expected in other text editors and IDEs.
Version: Apache NetBeans IDE 12.2
For example - the selection:
a string consisting of multiple words
Press Shift + 2 (where " is on my keyboard layout):
"a string consisting of multiple words"
OK....
You were right when you said that you could not find anything close this shortcut. I looked through the entire list and there was none. The only thing close to it was to surround a single word in quotes. So, that means that you will have to create one shortcut to surround text selection in quotes and another with parentheses. They will be very similar, but will require two different hotkeys.
For example, I created a shortcut to surround text selection in quotes. To do so, you have to go to Tools -> Options -> Editor and click New button
In the "New Macro Dialog" enter a name (i.e. "quote-selection") and click "OK". Then, type in copy-to-clipboard "\"" paste-from-clipboard "\"" in the "Macro Code" text area. Lastly, click "Set Shortcut..." button and type in the exact sequence of key presses you want to use for your shortcut. Don't worry if you enter a shortcut already in use. It will warn you if you do. I chose to use CNTL+ALT+3 because that's not in use. When you are satisfied, just click "OK" to record your shortcut. If you make a mistake in the key presses, simply click "Clear".
Then, repeat the process for surrounding with parentheses with the macro code copy-to-clipboard "(" paste-from-clipboard ")". When you are done, click "Apply" and "OK".
I used Netbeans version 12.3, so I expect everything shown here should be very similar (if not identical) to 12.2.
Sorry for roughly worded question.
I'll start typing something in VS Code like class="bob", and as soon as I type the opening " mark, VS Code will auto populate the closing " mark as well. Very helpful! BUT, once I'm done entering my string of information, I find myself having to adjust my keys on my keyboard to arrow right past the character that was automatically added, then hit a space, and continue on my coding way.
However this can interrupt my typing flow, as it would be just as easy if not easier for me to type the closing " mark myself without adjusting my hand from the default keyboard position.
This happens with other characters, too, not just quotes. Parentheses, brackets, single quotes, and similar items that show up in pairs.
When I watch videos of some people coding, they seem to gracefully whiz by those auto-added closing punctuation marks, so it makes me think there is something I'm missing in how I accept that automated input. Some way that is more zen like than using a right arrow.
Any guidance is much appreciated.
This worked for me;
Go to VS Code settings
Search "autoclose"
Disable "Auto Closing Tags"
Change "Auto Closing Quotes" from 'always' to 'never'
Change "Auto Closing Brackets" from 'always' to 'never'
You have several options:
Type the character that added automatically. For example, if you type { and automatically VS Code added } you can also type } to continue typing whatever you want. VS Code is smart to not doubling the automatically added character
Use End key
Use arrow right key
I think the VS Code team didn't find it needed to add some special key for this need, since all these options are also one key each.
I'm using the Groovy editor in Eclipse. When I compile/seed my script I sometimes get the below output.
839: expecting '}', found '' # line 839, column 1
The line above is the last line in the script which doesn't tell me much. It just says there is a closing brace missing somewhere in the script. One way I typically try is to zoom out (ctrl -) as much as possible in my editor (after source code formatting) then I try to look for something that looks oddly indented. The problem is some blocks are quite long so this is not ideal...
Is there a better approach or easier way to find out where the missing brace is in Eclipse? Or using another app (i.e. Notepad++, Sublime)? I would like to avoid using online tools pasting sensitive code.
When you place the cursor after an opening brace, the editor will highlight the closing brace. And you can jump to the closing brace using Go to Matching Bracket (Ctrl+Shift+P). Similarly, you can place the cursor just before a closing brace to highlight the opening brace and use the same command to jump to it. Using these aids, you should be able to narrow down where the unpaired opening brace is.
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
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.