README.md (1716B)
1 # Syntax based indentation for SQL files for GNU Emacs 2 3 ![CI](https://github.com/alex-hhh/emacs-sql-indent/workflows/CI/badge.svg) 4 5 sql-indent.el is a GNU Emacs minor mode which adds support for syntax-based 6 indentation when editing SQL code: TAB indents the current line based on the 7 syntax of the SQL code on previous lines. This works like the indentation for 8 C and C++ code. 9 10 The package also defines align rules so that the `align` function works for 11 SQL statements, see `sqlind-align-rules` for which rules are defined. This 12 can be used to align multiple lines around equal signs or "as" statements, 13 like this. 14 15 `sqlind-minor-mode` together with the align rules can assist in writing tidy 16 SQL code or formatting existing SQL code. The indentation rules are 17 customizable and they can be adapted to match your coding style. 18 19 See the [manual](./sql-indent.org) for more details. 20 21 # Installation 22 23 You can install a released version of this package 24 from [GNU ELPA](http://elpa.gnu.org/packages/sql-indent.html), by running the 25 following commands in Emacs: 26 27 M-x package-install RET sql-indent RET 28 29 To install sql-indent from this repository, open the file `sql-indent.el` in 30 Emacs and type: 31 32 M-x package-install-from-buffer RET 33 34 The syntax-based indentation of SQL code can be turned ON/OFF at any time by 35 enabling or disabling `sqlind-minor-mode`: 36 37 M-x sqlind-minor-mode RET 38 39 To enable syntax-based indentation for every SQL buffer, you can add 40 `sqlind-minor-mode` to `sql-mode-hook`. First, bring up the customization 41 buffer using the command: 42 43 M-x customize-variable RET sql-mode-hook RET 44 45 Than, click on the "INS" button to add a new entry and put "sqlind-minor-mode" 46 in the text field. 47