I think I have accidentally overridden one of the default settings in the NetBeans editor (7.2 on Windows 7) and a beautiful feature is gone.
Bracket completion feature is now effected.
I am new to NetBeans. When I used to type
echo "
NetBeans used to place the matching "
and put the cursor right after the first quote
echo "|"` // here the `|` denotes the cursor
So when I see the cursor there, I just type... And when I am done typing, I used to be able simply to hit enter (while the cursor is still inside the closing quote) and NetBeans used to automatically put the semi-column at the end of the line (after the closing quote) and advance me to the next line - very nicely. But now, the enter totally creates a new line, pushing the closing quote also to the next line. And obviously, no more semi-column.
So I end up getting this now
echo "test
"
The enter used to give me this instead;
echo "test";
I wonder what went wrong and where. Now I have to hit right arrow to get to the right side of the closing quote and place a semi-column manually and then hit enter.
How do you bring back default settings? What do you do in situations like this?
Running Windows 7 and NetBeans 7.2.1
The settings are stored in XML files in your user directory:
Example
${userdir}/config/Editors/text/{PROGRAMMING_LANGUAGE_HERE}/Preferences/org-netbeans-modules-editor-settings-CustomPreferences.xml.
If you delete this file the language settings (including formatting) will be set to default.
I'm not totally sure that feature is in the language setting, but just check the config directory and delete files until that feature is back!
You can also delete specific parts of the XML file to reset only some settings.
After the discussion in the comments and some search, I found this link as an alternative to your specific request. I'll still leave the original answer there since it answers the question in the title (and to help with future people who use the search function).
Netbeans Tip: Adding a semicolon to the end of a line for PHP
When writing Java in Netbeans there is a handy shortcut that places a semi-colon (;) at the end of the line, simply by pressing ctrl+;. That doesn’t sound like a big deal, but it seems I often write a piece of code yet somehow not have a semi-colon at the end. I think it’s to do with the code complete (eg. The IDE never quite lets me get to the end of the line before I finish writing the code I want to write – it’s a good thing really). However, this feature isn’t available when writing PHP.
Proof of how handy I actually find this shortcut is that I’m now forever trying to do it in Netbeans when writing PHP, only to be left disappointed.
How to do it in Netbeans for PHP
However, there’s a quick way to create this functionality in Netbeans (and any editor that provides macros support):
In Netbeans, click somewhere in the text editor.
Select Edit > Start Macro
Now whilst in the editor, press the ‘end’ key followed by the ‘;’ key. You should now have a semicolon at the end of your line.
Select Edit > Stop Macro
Give your macro a name (eg. “Append ;”)
Click ‘Set Shortcut’
Press “ctrl+;” and click OK
You’re done!
Also, in Options -> Editor -> Code Templates
, you have a bunch of templates, including a eco shortcut which does EXACTLY what you want (double quotes, ;, etc..)! For some reason, those templates won't work for me with the default setting "Expand Template On TAB", but if I change it to CTRL+SPACE, it works perfectly!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With