When a file is first opened, j does its best to detect what kind of file it is and open it using the appropriate mode. Except for archives and image files, binary files are always opened in binary mode.
J uses regular expressions to determine what mode to use based on the name of the file. These are j's internal defaults:
You can customize this behavior by supplying different values for these regular expressions in your preferences file.
If the filename doesn't match any of these regular expressions, j examines the first line of the file. If the line begins with "#!", the file is loaded in Perl mode or shell script mode, if appropriate.
If the filename doesn't match any of these regular expressions, j defaults to plain text mode, so it's not necessary or useful to assign a regular expression for plain text mode.
You can use the Properties dialog to change the mode and mode-specific properties of the current buffer. The Properties dialog is available on the File menu and is mapped by default to Alt P. J makes an effort to remember any changes you make in the Properties dialog in case you load the same file again.
You can specify default values for mode-specific properties in your preferences file. You can specify global defaults and override them for specific modes, like this:
#Global defaults tabWidth=4 indentSize=2 # Override for C++ mode. CppMode.tabWidth=4 CppMode.indentBeforeBrace=true CppMode.indentAfterBrace=false # Override for Java mode. JavaMode.indentSize=2