-1

I put set auto-indent in ~/.nanorc but auto-indent still not work. typing nano lol.java:

public class lol {
public static void main(String[] args) {
}
}

I'm on macOS.

efgvdfv
  • 11
  • 1

1 Answers1

0

nano is a very simple editor, and doesn't have language-specific syntax features. The autoindent setting (note, no hyphen) is described in the nano settings documentation:

Automatically indent a newly created line to the same number of tabs and/or spaces as the previous line (or as the next line if the previous line is the beginning of a paragraph).

So the indentation is only applied when the previous line is already indented. It does not add indentation based on blocks identified by curly braces in Java.

Tim Moore
  • 8,958
  • 2
  • 23
  • 34