diff --git a/runtime/help/options.md b/runtime/help/options.md index da502ab7..0a85d4ae 100644 --- a/runtime/help/options.md +++ b/runtime/help/options.md @@ -8,7 +8,7 @@ the config directory. Here are the options that you can set: -* `autoindent`: when creating a new line use the same indentation as the +* `autoindent`: when creating a new line, use the same indentation as the previous line. default value: `true` @@ -51,7 +51,8 @@ Here are the options that you can set: default value: `true` -* `eofnewline`: micro will automatically add a newline to the file. +* `eofnewline`: micro will automatically add a newline to the end of the file + when saving. default value: `false` @@ -67,11 +68,12 @@ Here are the options that you can set: default value: `true` * `fileformat`: this determines what kind of line endings micro will use for the - file. UNIX line endings are just `\n` (lf) whereas dos line endings are - `\r\n` (crlf). The two possible values for this option are `unix` and `dos`. - The fileformat will be automatically detected and displayed on the statusline - but this option is useful if you would like to change the line endings or if - you are starting a new file. + file. UNIX line endings are just `\n` (linefeed) whereas dos line endings are + `\r\n` (carriage return + linefeed). The two possible values for this option + are `unix` and `dos`. The fileformat will be automatically detected (when you + open an existing file) and displayed on the statusline, but this option is + useful if you would like to change the line endings or if you are starting a + new file. default value: `unix` @@ -87,7 +89,7 @@ Here are the options that you can set: * `indentchar`: sets the indentation character. - default value: ` ` + default value: ` ` (space) * `infobar`: enables the line at the bottom of the editor where messages are printed. This option is `global only`. @@ -96,8 +98,8 @@ Here are the options that you can set: * `keepautoindent`: when using autoindent, whitespace is added for you. This option determines if when you move to the next line without any insertions - the whitespace that was added should be deleted. By default the autoindent - whitespace is deleted if the line was left empty. + the whitespace that was added should be deleted to remove trailing whitespace. + By default, the autoindent whitespace is deleted if the line was left empty. default value: `false` @@ -198,7 +200,7 @@ Here are the options that you can set: default value: `false` -* `syntax`: turns syntax on or off. +* `syntax`: turns syntax highlighting on or off. default value: `true` diff --git a/runtime/syntax/d.yaml b/runtime/syntax/d.yaml index 10f69cac..db9fd695 100644 --- a/runtime/syntax/d.yaml +++ b/runtime/syntax/d.yaml @@ -27,6 +27,7 @@ rules: - constant.string: start: "'" end: "'" + skip: "\\\\." rules: - constant.specialChar: "\\\\." # Keywords diff --git a/runtime/syntax/elm.yaml b/runtime/syntax/elm.yaml new file mode 100644 index 00000000..db7f953b --- /dev/null +++ b/runtime/syntax/elm.yaml @@ -0,0 +1,38 @@ +filetype: elm + +detect: + filename: "\\.elm$" + +rules: + - statement: "\\b(as|alias|case|else|exposing|if|import|in|let|module|of|port|then|type|)\\b" + - statement: "(\\=|\\:|\\->)" + - type: "\\b([A-Z][A-Za-z\\d]*)\\b" + - identifier: "^([a-z][A-Za-z\\d]*)\\b" + - constant.string: + start: "\"\"\"" + end: "\"\"\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - comment: + start: "--" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + - comment: + start: "\\{-" + end: "-\\}" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/runtime/syntax/javascript.yaml b/runtime/syntax/javascript.yaml index e0ffa193..f0ec9b97 100644 --- a/runtime/syntax/javascript.yaml +++ b/runtime/syntax/javascript.yaml @@ -23,6 +23,7 @@ rules: # reserved but unassigned - error: "\\b(enum|implements|interface|package|private|protected|public|TODO)" - constant: "\\b(globalThis|Infinity|null|undefined|NaN)\\b" + - constant: "\\b(null|undefined|NaN)\\b" - constant: "\\b(true|false)\\b" - type: "\\b(Array|Boolean|Date|Enumerator|Error|Function|Math|Map|Set|WeakMap|WeakSet)\\b" - type: "\\b(Number|Object|RegExp|String)\\b" diff --git a/runtime/syntax/julia.yaml b/runtime/syntax/julia.yaml index c92a0ddf..73cbd5bf 100644 --- a/runtime/syntax/julia.yaml +++ b/runtime/syntax/julia.yaml @@ -21,9 +21,9 @@ rules: # parentheses - symbol.brackets: "([(){}]|\\[|\\])" # numbers - - constant.number: "\\b[0-9]+\\b" + - constant.number: "\\b([0-9]+(_[0-9]+)*|0x[0-9a-fA-F]+(_[0-9a-fA-F]+)*|0b[01]+(_[01]+)*|0o[0-7]+(_[0-7]+)*)\\b" - - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'" + - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^']){1}'" - constant.string: start: "\"\"\"" diff --git a/runtime/syntax/nim.yaml b/runtime/syntax/nim.yaml index e766cad9..94b37ce4 100644 --- a/runtime/syntax/nim.yaml +++ b/runtime/syntax/nim.yaml @@ -1,7 +1,7 @@ filetype: nim detect: - filename: "\\.nim$" + filename: "\\.nim$|\\.nims$|nim.cfg" rules: - preproc: "[\\{\\|]\\b(atom|lit|sym|ident|call|lvalue|sideeffect|nosideeffect|param|genericparam|module|type|let|var|const|result|proc|method|iterator|converter|macro|template|field|enumfield|forvar|label|nk[a-zA-Z]+|alias|noalias)\\b[\\}\\|]" diff --git a/runtime/syntax/vue.yaml b/runtime/syntax/vue.yaml new file mode 100644 index 00000000..4c1c3040 --- /dev/null +++ b/runtime/syntax/vue.yaml @@ -0,0 +1,24 @@ +filetype: vue + +detect: + filename: "\\.vue$" + +rules: + - default: + start: "" + end: "" + rules: + - include: "html5" + + - default: + start: "" + end: "" + rules: + - include: "javascript" + + - default: + start: "" + end: "" + rules: + - include: "css" + \ No newline at end of file diff --git a/runtime/syntax/zig.yaml b/runtime/syntax/zig.yaml new file mode 100644 index 00000000..5c748626 --- /dev/null +++ b/runtime/syntax/zig.yaml @@ -0,0 +1,37 @@ +filetype: zig + +detect: + filename: "\\.zig$" + +rules: + # function definition + - identifier: "fn [a-z0-9_]+" + # Reserved words + - statement: "\\b(align|and|allowzero|anyerror|asm|async|await|break|cancel|catch|comptime|const|continue|defer|else|enum|errdefer|error|export|extern|false|fn|for|if|inline|nakedcc|noalias|null|or|orelse|packed|promise|pub|resume|return|linksection|stdcallcc|struct|suspend|switch|test|threadlocal|true|try|undefined|union|unreachable|use|var|volatile|while)\\b" + # builtin functions + - special: "@+[a-z_]+" + # Constants + - constant: "[A-Z][A-Z_]+([0-9]+)?" + # Numbers (hexadecimal + decimal) + - constant.number: "\\b(0x[A-F0-9]+|[0-9]+)\\b" + # Primitive Types / Derived Data Types + - type: "([A-Z][a-z]+|(i8|u8|i16|u16|i32|u32|i64|u64|i128|u128|isize|usize|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|c_longlong|c_ulonglong|c_longdouble|c_void|f16|f32|f64|f128|bool|void|noreturn|type|anyerror|comptime_int|comptime_float))" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?"