| 1 |
# Syntax Files |
| 2 |
|
| 3 |
Here are micro's syntax files. |
| 4 |
|
| 5 |
Each yaml file specifies how to detect the filetype based on file extension or header (first line of the line). |
| 6 |
In addition, a signature can be provided to help resolving ambiguities when multiple matching filetypes are detected. |
| 7 |
Then there are patterns and regions linked to highlight groups which tell micro how to highlight that filetype. |
| 8 |
|
| 9 |
You can read more about how to write syntax files (and colorschemes) in the [colors](../help/colors.md) documentation. |
| 10 |
|
| 11 |
# Legacy '.micro' filetype |
| 12 |
|
| 13 |
Micro used to use the `.micro` filetype for syntax files which is no longer supported. If you have `.micro` |
| 14 |
syntax files that you would like to convert to the new filetype, you can use the [`syntax_converter.go`](./syntax_converter.go) program (also located in this directory): |
| 15 |
|
| 16 |
``` |
| 17 |
$ go run syntax_converter.go c.micro > c.yaml |
| 18 |
``` |
| 19 |
|
| 20 |
Most of the syntax files here have been converted using that tool. |
| 21 |
|
| 22 |
Note that the tool isn't perfect and though it is unlikely, you may run into some small issues that you will have to fix manually |
| 23 |
(about 4 files from this directory had issues after being converted). |
| 24 |
|
| 25 |
# Micro syntax highlighting files |
| 26 |
|
| 27 |
These are the syntax highlighting files for micro. To install them, just |
| 28 |
put all the syntax files in `~/.config/micro/syntax`. |
| 29 |
|
| 30 |
They are taken from Nano, specifically from [this repository](https://github.com/scopatz/nanorc). |
| 31 |
Micro syntax files are almost identical to Nano's, except for some key differences: |
| 32 |
|
| 33 |
* Micro does not use `icolor`. Instead, for a case insensitive match, use the case insensitive flag (`i`) in the regular expression |
| 34 |
* For example, `icolor green ".*"` would become `color green "(?i).*"` |
| 35 |
|
| 36 |
# Using with colorschemes |
| 37 |
|
| 38 |
Not all of these files have been converted to use micro's colorscheme feature. Most of them just hardcode the colors, which can be problematic depending on the colorscheme you use. |
| 39 |
|
| 40 |
Here is a list of the files that have been converted to properly use colorschemes: |
| 41 |
|
| 42 |
* vi |
| 43 |
* go |
| 44 |
* c |
| 45 |
* d |
| 46 |
* markdown |
| 47 |
* html |
| 48 |
* lua |
| 49 |
* swift |
| 50 |
* rust |
| 51 |
* java |
| 52 |
* javascript |
| 53 |
* pascal |
| 54 |
* python |
| 55 |
* ruby |
| 56 |
* sh |
| 57 |
* git |
| 58 |
* tex |
| 59 |
* solidity |
| 60 |
|
| 61 |
# License |
| 62 |
|
| 63 |
See [LICENSE](LICENSE). |