bunmicro 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/LICENSE +22 -0
  2. package/PORTING.md +34 -0
  3. package/README.md +153 -0
  4. package/bmi +5 -0
  5. package/bun.lock +17 -0
  6. package/bunmicro +5 -0
  7. package/hlw.md +5 -0
  8. package/package.json +18 -0
  9. package/runtime/colorschemes/atom-dark.micro +33 -0
  10. package/runtime/colorschemes/bubblegum.micro +31 -0
  11. package/runtime/colorschemes/cmc-16.micro +47 -0
  12. package/runtime/colorschemes/cmc-tc.micro +43 -0
  13. package/runtime/colorschemes/darcula.micro +34 -0
  14. package/runtime/colorschemes/default.micro +1 -0
  15. package/runtime/colorschemes/dracula-tc.micro +49 -0
  16. package/runtime/colorschemes/dukedark-tc.micro +38 -0
  17. package/runtime/colorschemes/dukelight-tc.micro +38 -0
  18. package/runtime/colorschemes/dukeubuntu-tc.micro +38 -0
  19. package/runtime/colorschemes/geany.micro +29 -0
  20. package/runtime/colorschemes/gotham.micro +29 -0
  21. package/runtime/colorschemes/gruvbox-tc.micro +29 -0
  22. package/runtime/colorschemes/gruvbox.micro +26 -0
  23. package/runtime/colorschemes/material-tc.micro +36 -0
  24. package/runtime/colorschemes/monokai-dark.micro +28 -0
  25. package/runtime/colorschemes/monokai.micro +34 -0
  26. package/runtime/colorschemes/one-dark.micro +39 -0
  27. package/runtime/colorschemes/railscast.micro +37 -0
  28. package/runtime/colorschemes/simple.micro +33 -0
  29. package/runtime/colorschemes/solarized-tc.micro +31 -0
  30. package/runtime/colorschemes/solarized.micro +30 -0
  31. package/runtime/colorschemes/sunny-day.micro +29 -0
  32. package/runtime/colorschemes/twilight.micro +40 -0
  33. package/runtime/colorschemes/zenburn.micro +30 -0
  34. package/runtime/help/actions.md +161 -0
  35. package/runtime/help/colors.md +421 -0
  36. package/runtime/help/commands.md +161 -0
  37. package/runtime/help/copypaste.md +149 -0
  38. package/runtime/help/defaultkeys.md +141 -0
  39. package/runtime/help/help.md +63 -0
  40. package/runtime/help/keybindings.md +760 -0
  41. package/runtime/help/linter.md +90 -0
  42. package/runtime/help/options.md +701 -0
  43. package/runtime/help/plugins.md +544 -0
  44. package/runtime/help/tutorial.md +112 -0
  45. package/runtime/jsplugins/chapter/chapter.js +108 -0
  46. package/runtime/jsplugins/diff/diff.js +46 -0
  47. package/runtime/jsplugins/example/example.js +108 -0
  48. package/runtime/jsplugins/linter/linter.js +281 -0
  49. package/runtime/plugins/autoclose/autoclose.lua +75 -0
  50. package/runtime/plugins/ftoptions/ftoptions.lua +17 -0
  51. package/runtime/plugins/literate/README.md +5 -0
  52. package/runtime/plugins/literate/literate.lua +55 -0
  53. package/runtime/plugins/status/help/status.md +21 -0
  54. package/runtime/plugins/status/status.lua +62 -0
  55. package/runtime/syntax/LICENSE +22 -0
  56. package/runtime/syntax/PowerShell.yaml +128 -0
  57. package/runtime/syntax/README.md +63 -0
  58. package/runtime/syntax/ada.yaml +43 -0
  59. package/runtime/syntax/apacheconf.yaml +59 -0
  60. package/runtime/syntax/arduino.yaml +101 -0
  61. package/runtime/syntax/asciidoc.yaml +51 -0
  62. package/runtime/syntax/asm.yaml +123 -0
  63. package/runtime/syntax/ats.yaml +99 -0
  64. package/runtime/syntax/awk.yaml +44 -0
  65. package/runtime/syntax/b.yaml +87 -0
  66. package/runtime/syntax/bat.yaml +57 -0
  67. package/runtime/syntax/c.yaml +60 -0
  68. package/runtime/syntax/caddyfile.yaml +23 -0
  69. package/runtime/syntax/cake.yaml +7 -0
  70. package/runtime/syntax/clojure.yaml +38 -0
  71. package/runtime/syntax/cmake.yaml +42 -0
  72. package/runtime/syntax/coffeescript.yaml +56 -0
  73. package/runtime/syntax/colortest.yaml +19 -0
  74. package/runtime/syntax/conky.yaml +17 -0
  75. package/runtime/syntax/cpp.yaml +91 -0
  76. package/runtime/syntax/crontab.yaml +36 -0
  77. package/runtime/syntax/crystal.yaml +72 -0
  78. package/runtime/syntax/csharp.yaml +52 -0
  79. package/runtime/syntax/css.yaml +44 -0
  80. package/runtime/syntax/csx.yaml +8 -0
  81. package/runtime/syntax/cuda.yaml +68 -0
  82. package/runtime/syntax/cython.yaml +52 -0
  83. package/runtime/syntax/d.yaml +121 -0
  84. package/runtime/syntax/dart.yaml +46 -0
  85. package/runtime/syntax/default.yaml +10 -0
  86. package/runtime/syntax/dockerfile.yaml +36 -0
  87. package/runtime/syntax/dot.yaml +29 -0
  88. package/runtime/syntax/elixir.yaml +30 -0
  89. package/runtime/syntax/elm.yaml +38 -0
  90. package/runtime/syntax/erb.yaml +42 -0
  91. package/runtime/syntax/erlang.yaml +45 -0
  92. package/runtime/syntax/fish.yaml +48 -0
  93. package/runtime/syntax/forth.yaml +34 -0
  94. package/runtime/syntax/fortran.yaml +64 -0
  95. package/runtime/syntax/freebsd-kernel.yaml +14 -0
  96. package/runtime/syntax/fsharp.yaml +48 -0
  97. package/runtime/syntax/gdscript.yaml +61 -0
  98. package/runtime/syntax/gemini.yaml +19 -0
  99. package/runtime/syntax/gentoo-ebuild.yaml +48 -0
  100. package/runtime/syntax/gentoo-etc-portage.yaml +23 -0
  101. package/runtime/syntax/git-commit.yaml +35 -0
  102. package/runtime/syntax/git-config.yaml +14 -0
  103. package/runtime/syntax/git-rebase-todo.yaml +19 -0
  104. package/runtime/syntax/gleam.yaml +69 -0
  105. package/runtime/syntax/glsl.yaml +26 -0
  106. package/runtime/syntax/gnuplot.yaml +15 -0
  107. package/runtime/syntax/go.yaml +62 -0
  108. package/runtime/syntax/godoc.yaml +17 -0
  109. package/runtime/syntax/golo.yaml +73 -0
  110. package/runtime/syntax/gomod.yaml +31 -0
  111. package/runtime/syntax/graphql.yaml +47 -0
  112. package/runtime/syntax/groff.yaml +30 -0
  113. package/runtime/syntax/groovy.yaml +111 -0
  114. package/runtime/syntax/haml.yaml +16 -0
  115. package/runtime/syntax/hare.yaml +52 -0
  116. package/runtime/syntax/haskell.yaml +52 -0
  117. package/runtime/syntax/hc.yaml +52 -0
  118. package/runtime/syntax/html.yaml +70 -0
  119. package/runtime/syntax/html4.yaml +25 -0
  120. package/runtime/syntax/html5.yaml +25 -0
  121. package/runtime/syntax/ini.yaml +23 -0
  122. package/runtime/syntax/inputrc.yaml +14 -0
  123. package/runtime/syntax/java.yaml +37 -0
  124. package/runtime/syntax/javascript.yaml +76 -0
  125. package/runtime/syntax/jinja2.yaml +19 -0
  126. package/runtime/syntax/json.yaml +39 -0
  127. package/runtime/syntax/jsonnet.yaml +92 -0
  128. package/runtime/syntax/julia.yaml +57 -0
  129. package/runtime/syntax/justfile.yaml +40 -0
  130. package/runtime/syntax/keymap.yaml +27 -0
  131. package/runtime/syntax/kickstart.yaml +16 -0
  132. package/runtime/syntax/kotlin.yaml +66 -0
  133. package/runtime/syntax/kvlang.yaml +67 -0
  134. package/runtime/syntax/ledger.yaml +14 -0
  135. package/runtime/syntax/lfe.yaml +17 -0
  136. package/runtime/syntax/lilypond.yaml +26 -0
  137. package/runtime/syntax/lisp.yaml +17 -0
  138. package/runtime/syntax/log.yaml +92 -0
  139. package/runtime/syntax/lua.yaml +111 -0
  140. package/runtime/syntax/mail.yaml +25 -0
  141. package/runtime/syntax/makefile.yaml +38 -0
  142. package/runtime/syntax/man.yaml +12 -0
  143. package/runtime/syntax/markdown.yaml +49 -0
  144. package/runtime/syntax/mc.yaml +23 -0
  145. package/runtime/syntax/meson.yaml +51 -0
  146. package/runtime/syntax/micro.yaml +34 -0
  147. package/runtime/syntax/mpdconf.yaml +13 -0
  148. package/runtime/syntax/msbuild.yaml +6 -0
  149. package/runtime/syntax/nanorc.yaml +16 -0
  150. package/runtime/syntax/nftables.yaml +30 -0
  151. package/runtime/syntax/nginx.yaml +22 -0
  152. package/runtime/syntax/nim.yaml +27 -0
  153. package/runtime/syntax/nix.yaml +32 -0
  154. package/runtime/syntax/nu.yaml +114 -0
  155. package/runtime/syntax/objc.yaml +60 -0
  156. package/runtime/syntax/ocaml.yaml +43 -0
  157. package/runtime/syntax/octave.yaml +83 -0
  158. package/runtime/syntax/odin.yaml +64 -0
  159. package/runtime/syntax/pascal.yaml +45 -0
  160. package/runtime/syntax/patch.yaml +14 -0
  161. package/runtime/syntax/peg.yaml +16 -0
  162. package/runtime/syntax/perl.yaml +58 -0
  163. package/runtime/syntax/php.yaml +60 -0
  164. package/runtime/syntax/pkg-config.yaml +12 -0
  165. package/runtime/syntax/po.yaml +12 -0
  166. package/runtime/syntax/pony.yaml +37 -0
  167. package/runtime/syntax/pov.yaml +21 -0
  168. package/runtime/syntax/privoxy-action.yaml +14 -0
  169. package/runtime/syntax/privoxy-config.yaml +10 -0
  170. package/runtime/syntax/privoxy-filter.yaml +12 -0
  171. package/runtime/syntax/proto.yaml +40 -0
  172. package/runtime/syntax/prql.yaml +84 -0
  173. package/runtime/syntax/puppet.yaml +22 -0
  174. package/runtime/syntax/python2.yaml +60 -0
  175. package/runtime/syntax/python3.yaml +62 -0
  176. package/runtime/syntax/r.yaml +32 -0
  177. package/runtime/syntax/raku.yaml +42 -0
  178. package/runtime/syntax/reST.yaml +18 -0
  179. package/runtime/syntax/renpy.yaml +15 -0
  180. package/runtime/syntax/rpmspec.yaml +43 -0
  181. package/runtime/syntax/ruby.yaml +73 -0
  182. package/runtime/syntax/rust.yaml +78 -0
  183. package/runtime/syntax/sage.yaml +60 -0
  184. package/runtime/syntax/scad.yaml +53 -0
  185. package/runtime/syntax/scala.yaml +33 -0
  186. package/runtime/syntax/sed.yaml +13 -0
  187. package/runtime/syntax/sh.yaml +69 -0
  188. package/runtime/syntax/sls.yaml +15 -0
  189. package/runtime/syntax/smalltalk.yaml +55 -0
  190. package/runtime/syntax/solidity.yaml +41 -0
  191. package/runtime/syntax/sql.yaml +35 -0
  192. package/runtime/syntax/stata.yaml +67 -0
  193. package/runtime/syntax/svelte.yaml +27 -0
  194. package/runtime/syntax/swift.yaml +103 -0
  195. package/runtime/syntax/systemd.yaml +16 -0
  196. package/runtime/syntax/tcl.yaml +18 -0
  197. package/runtime/syntax/terraform.yaml +87 -0
  198. package/runtime/syntax/tex.yaml +32 -0
  199. package/runtime/syntax/toml.yaml +56 -0
  200. package/runtime/syntax/twig.yaml +55 -0
  201. package/runtime/syntax/typescript.yaml +49 -0
  202. package/runtime/syntax/v.yaml +80 -0
  203. package/runtime/syntax/vala.yaml +26 -0
  204. package/runtime/syntax/verilog.yaml +60 -0
  205. package/runtime/syntax/vhdl.yaml +37 -0
  206. package/runtime/syntax/vi.yaml +31 -0
  207. package/runtime/syntax/vue.yaml +64 -0
  208. package/runtime/syntax/xml.yaml +37 -0
  209. package/runtime/syntax/xresources.yaml +14 -0
  210. package/runtime/syntax/yaml.yaml +34 -0
  211. package/runtime/syntax/yum.yaml +12 -0
  212. package/runtime/syntax/zig.yaml +52 -0
  213. package/runtime/syntax/zscript.yaml +72 -0
  214. package/runtime/syntax/zsh.yaml +52 -0
  215. package/src/buffer/buffer.js +126 -0
  216. package/src/buffer/loc.js +38 -0
  217. package/src/buffer/message.js +29 -0
  218. package/src/config/colorscheme.js +109 -0
  219. package/src/config/config.js +118 -0
  220. package/src/config/defaults.js +102 -0
  221. package/src/display/ansi-style.js +60 -0
  222. package/src/highlight/highlighter.js +237 -0
  223. package/src/highlight/parser.js +137 -0
  224. package/src/index.js +5942 -0
  225. package/src/lua/engine.js +38 -0
  226. package/src/platform/archive.js +50 -0
  227. package/src/platform/clipboard.js +160 -0
  228. package/src/platform/commands.js +140 -0
  229. package/src/plugins/js-bridge.js +902 -0
  230. package/src/plugins/manager.js +619 -0
  231. package/src/runtime/registry.js +89 -0
  232. package/src/screen/cell-buffer.js +81 -0
  233. package/src/screen/events.js +263 -0
  234. package/src/screen/screen.js +118 -0
  235. package/src/screen/vt100.js +391 -0
  236. package/src/shell/shell.js +70 -0
  237. package/todo.txt +359 -0
@@ -0,0 +1,55 @@
1
+ VERSION = "1.0.0"
2
+
3
+ local config = import("micro/config")
4
+
5
+ function startswith(str, start)
6
+ return string.sub(str,1,string.len(start))==start
7
+ end
8
+
9
+ function endswith(str, endStr)
10
+ return endStr=='' or string.sub(str,-string.len(endStr))==endStr
11
+ end
12
+
13
+ function split(string, sep)
14
+ local sep, fields = sep or ":", {}
15
+ local pattern = string.format("([^%s]+)", sep)
16
+ string:gsub(pattern, function(c) fields[#fields+1] = c end)
17
+ return fields
18
+ end
19
+
20
+ function onBufferOpen(buf)
21
+ if not endswith(buf.Path, ".lit") then
22
+ return
23
+ end
24
+
25
+ local codetype = "unknown"
26
+ for i=1,buf:LinesNum() do
27
+ local line = buf:Line(i-1)
28
+ if startswith(line, "@code_type") then
29
+ codetype = split(line, " ")[2]
30
+ break
31
+ end
32
+ end
33
+
34
+ local syntaxFile = ""
35
+ syntaxFile = syntaxFile .. "filetype: literate-" .. codetype .. "\n"
36
+ syntaxFile = syntaxFile .. "detect:\n"
37
+ syntaxFile = syntaxFile .. " filename: \"\\\\.lit$\"\n"
38
+ syntaxFile = syntaxFile .. "rules:\n"
39
+ syntaxFile = syntaxFile .. " - include: \"markdown\"\n"
40
+ syntaxFile = syntaxFile .. " - special: \"^(@s|@title|@code_type|@comment_type|@include|@change|@change_end)\"\n"
41
+ syntaxFile = syntaxFile .. " - special: \"(@add_css|@overwrite_css|@colorscheme|@compiler|@error_format|@book)\"\n"
42
+ syntaxFile = syntaxFile .. " - default:\n"
43
+ syntaxFile = syntaxFile .. " start: \"---.*$\"\n"
44
+ syntaxFile = syntaxFile .. " end: \"---$\"\n"
45
+ syntaxFile = syntaxFile .. " limit-group: \"identifier\"\n"
46
+ syntaxFile = syntaxFile .. " rules:\n"
47
+ syntaxFile = syntaxFile .. " - special:\n"
48
+ syntaxFile = syntaxFile .. " start: \"@\\\\{\"\n"
49
+ syntaxFile = syntaxFile .. " end: \"\\\\}\"\n"
50
+ syntaxFile = syntaxFile .. " - include: " .. codetype .. "\n"
51
+
52
+ config.AddRuntimeFileFromMemory(config.RTSyntax, "literate.yaml", syntaxFile)
53
+ config.Reload()
54
+ buf:UpdateRules()
55
+ end
@@ -0,0 +1,21 @@
1
+ # Status
2
+
3
+ The status plugin provides some functions for modifying the status line.
4
+
5
+ Using the `statusformatl` and `statusformatr` options, the exact contents
6
+ of the status line can be modified. Please see the documentation for
7
+ those options (`> help options`) for more information.
8
+
9
+ This plugin provides functions that can be used in the status line format:
10
+
11
+ * `status.branch`: returns the name of the current git branch in the repository
12
+ where the file is located.
13
+ * `status.hash`: returns the hash of the current git commit in the repository
14
+ where the file is located.
15
+ * `status.paste`: returns "" if the paste option is disabled and "PASTE"
16
+ if it is enabled.
17
+ * `status.lines`: returns the number of lines in the buffer.
18
+ * `status.vcol`: returns the visual column number of the cursor.
19
+ * `status.bytes`: returns the number of bytes in the current buffer.
20
+ * `status.size`: returns the size of the current buffer in a human-readable
21
+ format.
@@ -0,0 +1,62 @@
1
+ VERSION = "1.0.0"
2
+
3
+ local micro = import("micro")
4
+ local buffer = import("micro/buffer")
5
+ local config = import("micro/config")
6
+ local shell = import("micro/shell")
7
+ local filepath = import("filepath")
8
+ local humanize = import("humanize")
9
+ local strings = import("strings")
10
+
11
+ function init()
12
+ micro.SetStatusInfoFn("status.branch")
13
+ micro.SetStatusInfoFn("status.hash")
14
+ micro.SetStatusInfoFn("status.paste")
15
+ micro.SetStatusInfoFn("status.vcol")
16
+ micro.SetStatusInfoFn("status.lines")
17
+ micro.SetStatusInfoFn("status.bytes")
18
+ micro.SetStatusInfoFn("status.size")
19
+ config.AddRuntimeFile("status", config.RTHelp, "help/status.md")
20
+ end
21
+
22
+ function lines(b)
23
+ return tostring(b:LinesNum())
24
+ end
25
+
26
+ function vcol(b)
27
+ return tostring(b:GetActiveCursor():GetVisualX(false))
28
+ end
29
+
30
+ function bytes(b)
31
+ return tostring(b:Size())
32
+ end
33
+
34
+ function size(b)
35
+ return humanize.Bytes(b:Size())
36
+ end
37
+
38
+ local function parseRevision(b, opt)
39
+ if b.Type.Kind ~= buffer.BTInfo then
40
+ local dir = filepath.Dir(b.Path)
41
+ local str, err = shell.ExecCommand("git", "-C", dir, "rev-parse", opt, "HEAD")
42
+ if err == nil then
43
+ return strings.TrimSpace(str)
44
+ end
45
+ end
46
+ return ""
47
+ end
48
+
49
+ function branch(b)
50
+ return parseRevision(b, "--abbrev-ref")
51
+ end
52
+
53
+ function hash(b)
54
+ return parseRevision(b, "--short")
55
+ end
56
+
57
+ function paste(b)
58
+ if config.GetGlobalOption("paste") then
59
+ return "PASTE "
60
+ end
61
+ return ""
62
+ end
@@ -0,0 +1,22 @@
1
+ Micro's syntax files are licensed under the MIT "Expat" License:
2
+
3
+ Copyright (c) 2020: Zachary Yedidia, et al.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,128 @@
1
+ # PowerShell syntax highlighting file for micro - https://micro-editor.github.io/
2
+ # PowerShell syntax taken from: https://github.com/PowerShell/EditorSyntax
3
+
4
+ filetype: powershell
5
+
6
+ detect:
7
+ filename: "\\.ps(1|m1|d1)$"
8
+
9
+ rules:
10
+ # - comment.block: # Block Comment
11
+ # - comment.doc: # Doc Comment
12
+ # - comment.line: # Line Comment
13
+ # - comment.shebang: # Shebang Line
14
+
15
+ # - constant: # Constant
16
+ # - constant.bool: # Constant (true, false)
17
+ # - constant.interpolation:
18
+ # - constant.number: # Constant (null)
19
+ # - constant.specialChar:
20
+ # - constant.string: # String
21
+ # - constant.string.char:
22
+ # - constant.string.url: # Uri
23
+ # - constant.unicode:
24
+
25
+ # - identifier: # Also used for functions
26
+ # - identifier.class: # Also used for functions
27
+ # - identifier.macro:
28
+ # - identifier.var:
29
+
30
+ # - preproc: # Preprocessor
31
+ # - preproc.DebugIdentifier: # Preprocessor
32
+ # - preproc.shebang: # The #! at the beginning of a file that tells the os what script interpreter to use
33
+
34
+ # - special: # Special (global|local|private|script|using|workflow)
35
+
36
+ # - statement: # Statements Keywords
37
+ # - statement.built_in:
38
+ # - statement.declaration: # Declaration Keywords
39
+ # - statement.meta: # Meta
40
+ # - statement.reserved: # Reserved Keywords
41
+
42
+ # - symbol
43
+ # - symbol.brackets: # {}()[] and sometimes <>
44
+ # - symbol.operator: # Operators
45
+ # - symbol.tag: # For html tags, among other things
46
+
47
+ # - type
48
+ # - type.collections: # Collections (array, hashtable)
49
+ # - type.ctypes: # CTypes (CBool, CChar, etc.)
50
+ # - type.keyword: # If you want a special highlight for keywords like 'private'
51
+ # - type.storage: # Storage Types (int, uint, string, etc.)
52
+
53
+ # Class
54
+ - identifier.class: "class +[A-Za-z0-9]+ *((:) +[A-Za-z0-9.]+)?"
55
+ - identifier.class: "(function)(?:([[:space:]][A-Za-z0-9]+[[:space:]]*))"
56
+
57
+ # Verbs taken from PwSh 6.0.2
58
+ - identifier: "(Add|Approve|Assert|Backup|Block|Build|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy)[-][A-Za-z0-9]+"
59
+ - identifier: "(Debug|Deny|Deploy|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|Format|Get|Grant|Group|Hide)[-][A-Za-z0-9]+"
60
+ - identifier: "(Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Mount|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push)[-][A-Za-z0-9]+"
61
+ - identifier: "(Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke)[-][A-Za-z0-9]+"
62
+ - identifier: "(Save|Search|Select|Send|Set|Show|Skip|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Test|Trace)[-][A-Za-z0-9]+"
63
+ - identifier: "(Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Write)[-][A-Za-z0-9]+"
64
+ - identifier.var: "\\$(?i)((Global|Local|Private|Script|Using|Workflow)[:])?[A-Za-z0-9]*"
65
+
66
+
67
+ # Expression and types
68
+ - type: "\\[\\b([A-Za-z]+|[A-Za-z]+[0-9]+)\\b\\]"
69
+
70
+ # Keywords
71
+ - statement: "\\b(alias|as|begin|break|catch|continue|data|default|define|do|dynamicparam)\\b"
72
+ - statement: "\\b(else|elseif|end|exit|finally|for|foreach|foreach-object|from|if|in|inlinescript)\\b"
73
+ - statement: "\\b(parallel|param|process|return|switch|throw|trap|try|until|using|var|where|where-object|while)\\b"
74
+
75
+ # Special Keywords
76
+ - special: "\\b(break|continue|exit)\\b"
77
+
78
+ - symbol.brackets: "(\\{|\\})"
79
+ - symbol.brackets: "(\\(|\\))"
80
+ - symbol.brackets: "(\\[|\\])"
81
+ - symbol.operator: "[\\-+/*=<>?:!~%&|]"
82
+ - symbol.operator: "[[:space:]][-](ne|eq|gt|ge|lt|le|like|notlike|match|notmatch|contains|notcontains|in|notin|replace|is|isnot)[[:space:]]"
83
+
84
+ # Constants
85
+ - constant.bool: "\\b\\$(true|false|null)\\b"
86
+ - constant.number: "\\b([0-9._]+|0x[A-Fa-f0-9_]+|0b[0-1_]+)[FL]?\\b"
87
+
88
+ # Expression Mode String
89
+ - constant.string:
90
+ start: "\""
91
+ end: "\""
92
+ #skip: "\\\\."
93
+ rules:
94
+ - constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
95
+ - constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"
96
+
97
+ # Argument Mode String
98
+ - constant.string:
99
+ start: "'"
100
+ end: "'"
101
+ #skip: "\\\\."
102
+ rules:
103
+ - constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
104
+ - constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"
105
+
106
+ # Line Comment
107
+ - comment:
108
+ start: "#"
109
+ end: "$"
110
+ rules:
111
+ - todo: "(TODO|XXX|FIXME|BUG):?"
112
+
113
+ # Block Comment
114
+ - comment:
115
+ start: "<#"
116
+ end: "#>"
117
+ rules:
118
+ - todo: "(TODO|XXX|FIXME|BUG):?"
119
+
120
+ # Embedded C#
121
+ - default:
122
+ start: "@\""
123
+ end: "\"@"
124
+ rules:
125
+ - include: "csharp"
126
+
127
+ # Todo
128
+ - todo: "(TODO|XXX|FIXME|BUG):?"
@@ -0,0 +1,63 @@
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).
@@ -0,0 +1,43 @@
1
+ filetype: ada
2
+
3
+ detect:
4
+ filename: "(\\.ads$|\\.adb$|\\.ada$)"
5
+
6
+ rules:
7
+ # Operators
8
+ - symbol.operator: ([.:;,+*|=!?\\%]|<|>|/|-|&)
9
+ - symbol.brackets: "[(){}]|\\[|\\]"
10
+ # keyword.reserved
11
+ - statement.reserved: \b(abort|abs|abstract|accept|access|aliased|all|and|array|at|begin|body|case)\b
12
+ - statement.reserved: \b(constant|declare|delay|delta|digits|do|else|elsif|end|entry|exception|exit|for|function)\b
13
+ - statement.reserved: \b(generic|goto|if|in|interface|is|limited|loop|mod|new|not|null|of|or|others|out|overriding)\b
14
+ - statement.reserved: \b(package|pragma|private|procedure|protected|raise|range|record|rem|renames|return|requeue)\b
15
+ - statement.reserved: \b(reverse|select|separate|some|subtype|synchronized|tagged|task|terminate|then|type|until)\b
16
+ - statement.reserved: \b(use|when|while|with|xor)\b
17
+
18
+ # Constant
19
+ - constant.bool: \b(TRUE|FALSE)
20
+ - constant.number: ([0-9]+)
21
+
22
+ # Storage Types
23
+ - type.storage: \b(INTEGER|NATURAL|POSITIVE|FLOAT|CHARACTER|STRING)\b
24
+ - type.storage: \b(LONG_INTEGER|SHORT_INTEGER|LONG_FLOAT|SHORT_FLOAT)\b
25
+
26
+ #Character
27
+ - constant.string.char: \'.\'
28
+
29
+ # String
30
+ - constant.string:
31
+ start: \"
32
+ end: \"
33
+ skip: \\.
34
+ rules:
35
+ - constant.specialChar: (\\0|\\\\|\\t|\\n|\\r|\\"|\\')
36
+ - constant.interpolation: \\\([[:graph:]]*\)
37
+ - constant.unicode: \\u\{[[:xdigit:]]+}
38
+
39
+ # Line Comment
40
+ - comment.line: "--.*"
41
+
42
+ # Todo
43
+ - todo: "(TODO|XXX|FIXME):?"
@@ -0,0 +1,59 @@
1
+ filetype: apacheconf
2
+
3
+ detect:
4
+ filename: "httpd\\.conf|mime\\.types|vhosts\\.d\\\\*|\\.htaccess"
5
+
6
+ rules:
7
+ - identifier: "(AcceptMutex|AcceptPathInfo|AccessFileName|Action|AddAlt|AddAltByEncoding|AddAltByType|AddCharset|AddDefaultCharset|AddDescription|AddEncoding)"
8
+ - identifier: "(AddHandler|AddIcon|AddIconByEncoding|AddIconByType|AddInputFilter|AddLanguage|AddModuleInfo|AddOutputFilter|AddOutputFilterByType|AddType|Alias|AliasMatch)"
9
+ - identifier: "(Allow|AllowCONNECT|AllowEncodedSlashes|AllowOverride|Anonymous|Anonymous_Authoritative|Anonymous_LogEmail|Anonymous_MustGiveEmail|Anonymous_NoUserID)"
10
+ - identifier: "(Anonymous_VerifyEmail|AssignUserID|AuthAuthoritative|AuthDBMAuthoritative|AuthDBMGroupFile|AuthDBMType|AuthDBMUserFile|AuthDigestAlgorithm)"
11
+ - identifier: "(AuthDigestDomain|AuthDigestFile|AuthDigestGroupFile|AuthDigestNcCheck|AuthDigestNonceFormat|AuthDigestNonceLifetime|AuthDigestQop|AuthDigestShmemSize)"
12
+ - identifier: "(AuthGroupFile|AuthLDAPAuthoritative|AuthLDAPBindDN|AuthLDAPBindPassword|AuthLDAPCharsetConfig|AuthLDAPCompareDNOnServer|AuthLDAPDereferenceAliases)"
13
+ - identifier: "(AuthLDAPEnabled|AuthLDAPFrontPageHack|AuthLDAPGroupAttribute|AuthLDAPGroupAttributeIsDN|AuthLDAPRemoteUserIsDN|AuthLDAPUrl|AuthName|AuthType|AuthUserFile)"
14
+ - identifier: "(BrowserMatch|BrowserMatchNoCase|BS2000Account|BufferedLogs|CacheDefaultExpire|CacheDirLength|CacheDirLevels|CacheDisable|CacheEnable|CacheExpiryCheck)"
15
+ - identifier: "(CacheFile|CacheForceCompletion|CacheGcClean|CacheGcDaily|CacheGcInterval|CacheGcMemUsage|CacheGcUnused|CacheIgnoreCacheControl|CacheIgnoreHeaders)"
16
+ - identifier: "(CacheIgnoreNoLastMod|CacheLastModifiedFactor|CacheMaxExpire|CacheMaxFileSize|CacheMinFileSize|CacheNegotiatedDocs|CacheRoot|CacheSize|CacheTimeMargin)"
17
+ - identifier: "(CGIMapExtension|CharsetDefault|CharsetOptions|CharsetSourceEnc|CheckSpelling|ChildPerUserID|ContentDigest|CookieDomain|CookieExpires|CookieLog|CookieName)"
18
+ - identifier: "(CookieStyle|CookieTracking|CoreDumpDirectory|CustomLog|Dav|DavDepthInfinity|DavLockDB|DavMinTimeout|DefaultIcon|DefaultLanguage|DefaultType)"
19
+ - identifier: "(DeflateBufferSize|DeflateCompressionLevel|DeflateFilterNote|DeflateMemLevel|DeflateWindowSize|Deny|Directory|DirectoryIndex|DirectoryMatch|DirectorySlash)"
20
+ - identifier: "(DocumentRoot|DumpIOInput|DumpIOOutput|EnableExceptionHook|EnableMMAP|EnableSendfile|ErrorDocument|ErrorLog|Example|ExpiresActive|ExpiresByType)"
21
+ - identifier: "(ExpiresDefault|ExtendedStatus|ExtFilterDefine|ExtFilterOptions|FileETag|Files|FilesMatch|ForceLanguagePriority|ForceType|ForensicLog|Group|Header)"
22
+ - identifier: "(HeaderName|HostnameLookups|IdentityCheck|IfDefine|IfModule|IfVersion|ImapBase|ImapDefault|ImapMenu|Include|IndexIgnore|IndexOptions|IndexOrderDefault)"
23
+ - identifier: "(ISAPIAppendLogToErrors|ISAPIAppendLogToQuery|ISAPICacheFile|ISAPIFakeAsync|ISAPILogNotSupported|ISAPIReadAheadBuffer|KeepAlive|KeepAliveTimeout)"
24
+ - identifier: "(LanguagePriority|LDAPCacheEntries|LDAPCacheTTL|LDAPConnectionTimeout|LDAPOpCacheEntries|LDAPOpCacheTTL|LDAPSharedCacheFile|LDAPSharedCacheSize)"
25
+ - identifier: "(LDAPTrustedCA|LDAPTrustedCAType|Limit|LimitExcept|LimitInternalRecursion|LimitRequestBody|LimitRequestFields|LimitRequestFieldSize|LimitRequestLine)"
26
+ - identifier: "(LimitXMLRequestBody|Listen|ListenBackLog|LoadFile|LoadModule|Location|LocationMatch|LockFile|LogFormat|LogLevel|MaxClients|MaxKeepAliveRequests)"
27
+ - identifier: "(MaxMemFree|MaxRequestsPerChild|MaxRequestsPerThread|MaxSpareServers|MaxSpareThreads|MaxThreads|MaxThreadsPerChild|MCacheMaxObjectCount|MCacheMaxObjectSize)"
28
+ - identifier: "(MCacheMaxStreamingBuffer|MCacheMinObjectSize|MCacheRemovalAlgorithm|MCacheSize|MetaDir|MetaFiles|MetaSuffix|MimeMagicFile|MinSpareServers|MinSpareThreads)"
29
+ - identifier: "(MMapFile|ModMimeUsePathInfo|MultiviewsMatch|NameVirtualHost|NoProxy|NumServers|NWSSLTrustedCerts|NWSSLUpgradeable|Options|Order|PassEnv|PidFile)"
30
+ - identifier: "(ProtocolEcho|Proxy|ProxyBadHeader|ProxyBlock|ProxyDomain|ProxyErrorOverride|ProxyIOBufferSize|ProxyMatch|ProxyMaxForwards|ProxyPass|ProxyPassReverse)"
31
+ - identifier: "(ProxyPreserveHost|ProxyReceiveBufferSize|ProxyRemote|ProxyRemoteMatch|ProxyRequests|ProxyTimeout|ProxyVia|ReadmeName|Redirect|RedirectMatch)"
32
+ - identifier: "(RedirectPermanent|RedirectTemp|RemoveCharset|RemoveEncoding|RemoveHandler|RemoveInputFilter|RemoveLanguage|RemoveOutputFilter|RemoveType|RequestHeader)"
33
+ - identifier: "(Require|RewriteBase|RewriteCond|RewriteEngine|RewriteLock|RewriteLog|RewriteLogLevel|RewriteMap|RewriteOptions|RewriteRule|RLimitCPU|RLimitMEM|RLimitNPROC)"
34
+ - identifier: "(Satisfy|ScoreBoardFile|Script|ScriptAlias|ScriptAliasMatch|ScriptInterpreterSource|ScriptLog|ScriptLogBuffer|ScriptLogLength|ScriptSock|SecureListen)"
35
+ - identifier: "(SendBufferSize|ServerAdmin|ServerAlias|ServerLimit|ServerName|ServerPath|ServerRoot|ServerSignature|ServerTokens|SetEnv|SetEnvIf|SetEnvIfNoCase|SetHandler)"
36
+ - identifier: "(SetInputFilter|SetOutputFilter|SSIEndTag|SSIErrorMsg|SSIStartTag|SSITimeFormat|SSIUndefinedEcho|SSLCACertificateFile|SSLCACertificatePath)"
37
+ - identifier: "(SSLCARevocationFile|SSLCARevocationPath|SSLCertificateChainFile|SSLCertificateFile|SSLCertificateKeyFile|SSLCipherSuite|SSLEngine|SSLMutex|SSLOptions)"
38
+ - identifier: "(SSLPassPhraseDialog|SSLProtocol|SSLProxyCACertificateFile|SSLProxyCACertificatePath|SSLProxyCARevocationFile|SSLProxyCARevocationPath|SSLProxyCipherSuite)"
39
+ - identifier: "(SSLProxyEngine|SSLProxyMachineCertificateFile|SSLProxyMachineCertificatePath|SSLProxyProtocol|SSLProxyVerify|SSLProxyVerifyDepth|SSLRandomSeed|SSLRequire)"
40
+ - identifier: "(SSLRequireSSL|SSLSessionCache|SSLSessionCacheTimeout|SSLUserName|SSLVerifyClient|SSLVerifyDepth|StartServers|StartThreads|SuexecUserGroup|ThreadLimit)"
41
+ - identifier: "(ThreadsPerChild|ThreadStackSize|TimeOut|TraceEnable|TransferLog|TypesConfig|UnsetEnv|UseCanonicalName|User|UserDir|VirtualDocumentRoot)"
42
+ - identifier: "(VirtualDocumentRootIP|VirtualHost|VirtualScriptAlias|VirtualScriptAliasIP|Win32DisableAcceptEx|XBitHack)"
43
+ - symbol.tag: "<[^>]+>"
44
+ - identifier: "</?[A-Za-z]+"
45
+ - identifier: "(<|</|>)"
46
+
47
+ - constant.string:
48
+ start: "\""
49
+ end: "\""
50
+ skip: "\\\\."
51
+ rules:
52
+ - constant.specialChar: "\\\\."
53
+
54
+ - comment:
55
+ start: "#"
56
+ end: "$"
57
+ rules:
58
+ - todo: "(TODO|XXX|FIXME):?"
59
+
@@ -0,0 +1,101 @@
1
+ filetype: ino
2
+
3
+ detect:
4
+ filename: "\\.ino$"
5
+
6
+ rules:
7
+ - identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
8
+
9
+ ## Sized (u)int types
10
+ - type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
11
+
12
+ ## Constants
13
+ - constant: "(?i)\\b(HIGH|LOW|INPUT|OUTPUT)\\b"
14
+
15
+ ## Serial Print
16
+ - constant: "(?i)\\b(DEC|BIN|HEX|OCT|BYTE)\\b"
17
+
18
+ ## PI Constants
19
+ - constant: "(?i)\\b(PI|HALF_PI|TWO_PI)\\b"
20
+
21
+ ## ShiftOut
22
+ - constant: "(?i)\\b(LSBFIRST|MSBFIRST)\\b"
23
+
24
+ ## Attach Interrupt
25
+ - constant: "(?i)\\b(CHANGE|FALLING|RISING)\\b"
26
+
27
+ ## Analog Reference
28
+ - constant: "(?i)\\b(DEFAULT|EXTERNAL|INTERNAL|INTERNAL1V1|INTERNAL2V56)\\b"
29
+
30
+ ## === FUNCTIONS === ##
31
+
32
+ ## Data Types
33
+ - type: "\\b(boolean|byte|char|float|int|long|word)\\b"
34
+
35
+ ## Control Structions
36
+ - statement: "\\b(case|class|default|do|double|else|false|for|if|new|null|private|protected|public|short|signed|static|String|switch|this|throw|try|true|unsigned|void|while)\\b"
37
+ - statement: "\\b(goto|continue|break|return)\\b"
38
+
39
+ ## Math
40
+ - identifier: "\\b(abs|acos|asin|atan|atan2|ceil|constrain|cos|degrees|exp|floor|log|map|max|min|radians|random|randomSeed|round|sin|sq|sqrt|tan)\\b"
41
+
42
+ ## Bits & Bytes
43
+ - identifier: "\\b(bitRead|bitWrite|bitSet|bitClear|bit|highByte|lowByte)\\b"
44
+
45
+ ## Analog I/O
46
+ - identifier: "\\b(analogReference|analogRead|analogWrite)\\b"
47
+
48
+ ## External Interrupts
49
+ - identifier: "\\b(attachInterrupt|detachInterrupt)\\b"
50
+
51
+ ## Time
52
+ - identifier: "\\b(delay|delayMicroseconds|millis|micros)\\b"
53
+
54
+ ## Digital I/O
55
+ - identifier: "\\b(pinMode|digitalWrite|digitalRead)\\b"
56
+
57
+ ## Interrupts
58
+ - identifier: "\\b(interrupts|noInterrupts)\\b"
59
+
60
+ ## Advanced I/O
61
+ - identifier: "\\b(noTone|pulseIn|shiftIn|shiftOut|tone)\\b"
62
+
63
+ ## Serial
64
+ - identifier: "\\b(Serial|Serial1|Serial2|Serial3|begin|end|peek|read|print|println|available|flush)\\b"
65
+
66
+ ## Structure
67
+ - identifier: "\\b(setup|loop)\\b"
68
+
69
+ ##
70
+ - statement: "^[[:space:]]*#[[:space:]]*(define|include(_next)?|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma)"
71
+
72
+ ## GCC builtins
73
+ - constant: "(__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__)"
74
+
75
+ - constant.string:
76
+ start: "\""
77
+ end: "\""
78
+ skip: "\\\\."
79
+ rules:
80
+ - constant.specialChar: "\\\\."
81
+
82
+ - constant.string:
83
+ start: "'"
84
+ end: "'"
85
+ skip: "\\\\."
86
+ rules:
87
+ - preproc: "..+"
88
+ - constant.specialChar: "\\\\."
89
+
90
+ - comment:
91
+ start: "//"
92
+ end: "$"
93
+ rules:
94
+ - todo: "(TODO|XXX|FIXME):?"
95
+
96
+ - comment:
97
+ start: "/\\*"
98
+ end: "\\*/"
99
+ rules:
100
+ - todo: "(TODO|XXX|FIXME):?"
101
+
@@ -0,0 +1,51 @@
1
+ filetype: asciidoc
2
+
3
+ detect:
4
+ filename: "\\.(asc|asciidoc|adoc)$"
5
+
6
+ rules:
7
+ # main header
8
+ - preproc: "^====+$"
9
+ # h1
10
+ - statement: "^==[[:space:]].*$"
11
+ - statement: "^----+$"
12
+ # h2
13
+ - symbol: "^===[[:space:]].*$"
14
+ - symbol: "^~~~~+$"
15
+ # h4
16
+ - type: "^====[[:space:]].*$"
17
+ - type: "^\\^\\^\\^\\^+$"
18
+ # h5
19
+ - constant: "^=====[[:space:]].*$"
20
+ - constant: "^\\+\\+\\+\\++$"
21
+
22
+ # attributes
23
+ - type.keyword: ":.*:"
24
+ - identifier.macro: "\\{[a-z0-9]*\\}"
25
+ - identifier: "\\\\\\{[a-z0-9]*\\}"
26
+ - identifier: "\\+\\+\\+\\{[a-z0-9]*\\}\\+\\+\\+"
27
+
28
+ # Paragraph Title
29
+ - statement: "^\\..*$"
30
+
31
+ # source
32
+ - identifier: "^\\[(source,.+|NOTE|TIP|IMPORTANT|WARNING|CAUTION)\\]"
33
+
34
+ # Other markup
35
+ - constant.string: ".*[[:space:]]\\+$"
36
+ - constant.string: "_[^_]+_"
37
+ - constant.string: "\\*[^\\*]+\\*"
38
+ - constant.string: "\\+[^\\+]+\\+"
39
+ - constant.string: "`[^`]+`"
40
+ - constant.string: "\\^[^\\^]+\\^"
41
+ - constant.string: "~[^~]+~"
42
+ - constant.string: "'[^']+'"
43
+
44
+ - constant: "`{1,2}[^']+'{1,2}"
45
+
46
+ # bullets
47
+ - symbol: "^[[:space:]]*[\\*\\.-]{1,5}[[:space:]]"
48
+
49
+ # anchors
50
+ - "bold default": "\\[\\[.*\\]\\]"
51
+ - "bold default": "<<.*>>"