Reputation: 256661
How do i disable automatic indenting when i press Enter in NetBeans IDE?
Consider some code, with my insertion caret at the end of the last line:
byte[] data;
try {
data = Base64.getDecoder().decode(s);
‸
When i press Enter, it's because i want to insert a carriage return, and move the caret to the start of the next line:
byte[] data;
try {
data = Base64.getDecoder().decode(s);
Enter
‸
Except what happens in NetBeans, is that also automatically indents for me:
byte[] data;
try {
data = Base64.getDecoder().decode(s);
Enter
Tab‸
How do i turn this off?
Upvotes: 1
Views: 498
Reputation: 17353
It is straightforward to turn off automatic indentation in NetBeans 14, but the process is not intuitive for Java source. These settings must be applied in sequence after navigating to the Tools > Options > Editor > Formatting screen:
Select Language: All Languages and Category: Tabs and Indents, and then uncheck the checkbox Enable Indentation and click the Apply button. This will turn off automatic indentation for all languages by default, but that global setting might still be overridden for individual languages.
Select Language: Java and Category: Tabs and Indents, and then uncheck the checkboxes Use all Languages Settings and Enable Indentation, and click the OK button.
After making those changes the modified fields should look like this if you revisit the Tools > Options > Editor > Formatting screen:
Then, using your sample code, if the cursor is positioned at the end of the line containing data = Base64.getDecoder().decode(s);
and Enter is pressed:
This is the sample code I used:
package javaantapplication1;
import java.util.Base64;
public class JavaAntApplication1 {
private static byte[] s;
public static void main(String[] args) {
byte[] data;
try {
data = Base64.getDecoder().decode(s);
}
}
Notes:
Upvotes: 2