jsmdcui 0.3.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 (258) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/LICENSE +22 -0
  3. package/README.md +285 -0
  4. package/package.json +17 -0
  5. package/project_structure.txt +35 -0
  6. package/runmd.mjs +240 -0
  7. package/runtime/colorschemes/atom-dark.micro +33 -0
  8. package/runtime/colorschemes/bubblegum.micro +31 -0
  9. package/runtime/colorschemes/cmc-16.micro +47 -0
  10. package/runtime/colorschemes/cmc-tc.micro +43 -0
  11. package/runtime/colorschemes/darcula.micro +34 -0
  12. package/runtime/colorschemes/default.micro +1 -0
  13. package/runtime/colorschemes/dracula-tc.micro +49 -0
  14. package/runtime/colorschemes/dukedark-tc.micro +38 -0
  15. package/runtime/colorschemes/dukelight-tc.micro +38 -0
  16. package/runtime/colorschemes/dukeubuntu-tc.micro +38 -0
  17. package/runtime/colorschemes/geany.micro +29 -0
  18. package/runtime/colorschemes/gotham.micro +29 -0
  19. package/runtime/colorschemes/gruvbox-tc.micro +29 -0
  20. package/runtime/colorschemes/gruvbox.micro +26 -0
  21. package/runtime/colorschemes/material-tc.micro +36 -0
  22. package/runtime/colorschemes/monokai-dark.micro +28 -0
  23. package/runtime/colorschemes/monokai.micro +34 -0
  24. package/runtime/colorschemes/one-dark.micro +39 -0
  25. package/runtime/colorschemes/railscast.micro +37 -0
  26. package/runtime/colorschemes/simple.micro +33 -0
  27. package/runtime/colorschemes/solarized-tc.micro +31 -0
  28. package/runtime/colorschemes/solarized.micro +30 -0
  29. package/runtime/colorschemes/sunny-day.micro +29 -0
  30. package/runtime/colorschemes/twilight.micro +40 -0
  31. package/runtime/colorschemes/zenburn.micro +30 -0
  32. package/runtime/help/actions.md +161 -0
  33. package/runtime/help/cdp.md +119 -0
  34. package/runtime/help/colors.md +421 -0
  35. package/runtime/help/commands.md +161 -0
  36. package/runtime/help/copypaste.md +149 -0
  37. package/runtime/help/defaultkeys.md +148 -0
  38. package/runtime/help/help.md +285 -0
  39. package/runtime/help/keybindings.md +355 -0
  40. package/runtime/help/linter.md +90 -0
  41. package/runtime/help/options.md +709 -0
  42. package/runtime/help/plugins.md +544 -0
  43. package/runtime/help/tutorial.md +112 -0
  44. package/runtime/jsplugins/cdp/cdp-server.js +1161 -0
  45. package/runtime/jsplugins/cdp/cdp.js +192 -0
  46. package/runtime/jsplugins/chapter/chapter.js +108 -0
  47. package/runtime/jsplugins/diff/diff.js +46 -0
  48. package/runtime/jsplugins/example/example.js +110 -0
  49. package/runtime/jsplugins/linter/linter.js +281 -0
  50. package/runtime/plugins/autoclose/autoclose.lua +75 -0
  51. package/runtime/plugins/ftoptions/ftoptions.lua +17 -0
  52. package/runtime/plugins/literate/README.md +5 -0
  53. package/runtime/plugins/literate/literate.lua +55 -0
  54. package/runtime/plugins/status/help/status.md +21 -0
  55. package/runtime/plugins/status/status.lua +62 -0
  56. package/runtime/syntax/LICENSE +22 -0
  57. package/runtime/syntax/PowerShell.yaml +128 -0
  58. package/runtime/syntax/README.md +63 -0
  59. package/runtime/syntax/ada.yaml +43 -0
  60. package/runtime/syntax/apacheconf.yaml +59 -0
  61. package/runtime/syntax/arduino.yaml +101 -0
  62. package/runtime/syntax/asciidoc.yaml +51 -0
  63. package/runtime/syntax/asm.yaml +123 -0
  64. package/runtime/syntax/ats.yaml +99 -0
  65. package/runtime/syntax/awk.yaml +44 -0
  66. package/runtime/syntax/b.yaml +87 -0
  67. package/runtime/syntax/bat.yaml +57 -0
  68. package/runtime/syntax/c.yaml +60 -0
  69. package/runtime/syntax/caddyfile.yaml +23 -0
  70. package/runtime/syntax/cake.yaml +7 -0
  71. package/runtime/syntax/clojure.yaml +38 -0
  72. package/runtime/syntax/cmake.yaml +42 -0
  73. package/runtime/syntax/coffeescript.yaml +56 -0
  74. package/runtime/syntax/colortest.yaml +19 -0
  75. package/runtime/syntax/conky.yaml +17 -0
  76. package/runtime/syntax/cpp.yaml +91 -0
  77. package/runtime/syntax/crontab.yaml +36 -0
  78. package/runtime/syntax/crystal.yaml +72 -0
  79. package/runtime/syntax/csharp.yaml +52 -0
  80. package/runtime/syntax/css.yaml +44 -0
  81. package/runtime/syntax/csx.yaml +8 -0
  82. package/runtime/syntax/cuda.yaml +68 -0
  83. package/runtime/syntax/cython.yaml +52 -0
  84. package/runtime/syntax/d.yaml +121 -0
  85. package/runtime/syntax/dart.yaml +46 -0
  86. package/runtime/syntax/default.yaml +10 -0
  87. package/runtime/syntax/dockerfile.yaml +36 -0
  88. package/runtime/syntax/dot.yaml +29 -0
  89. package/runtime/syntax/elixir.yaml +30 -0
  90. package/runtime/syntax/elm.yaml +38 -0
  91. package/runtime/syntax/erb.yaml +42 -0
  92. package/runtime/syntax/erlang.yaml +45 -0
  93. package/runtime/syntax/fish.yaml +48 -0
  94. package/runtime/syntax/forth.yaml +34 -0
  95. package/runtime/syntax/fortran.yaml +64 -0
  96. package/runtime/syntax/freebsd-kernel.yaml +14 -0
  97. package/runtime/syntax/fsharp.yaml +48 -0
  98. package/runtime/syntax/gdscript.yaml +61 -0
  99. package/runtime/syntax/gemini.yaml +19 -0
  100. package/runtime/syntax/gentoo-ebuild.yaml +48 -0
  101. package/runtime/syntax/gentoo-etc-portage.yaml +23 -0
  102. package/runtime/syntax/git-commit.yaml +35 -0
  103. package/runtime/syntax/git-config.yaml +14 -0
  104. package/runtime/syntax/git-rebase-todo.yaml +19 -0
  105. package/runtime/syntax/gleam.yaml +69 -0
  106. package/runtime/syntax/glsl.yaml +26 -0
  107. package/runtime/syntax/gnuplot.yaml +15 -0
  108. package/runtime/syntax/go.yaml +62 -0
  109. package/runtime/syntax/godoc.yaml +17 -0
  110. package/runtime/syntax/golo.yaml +73 -0
  111. package/runtime/syntax/gomod.yaml +31 -0
  112. package/runtime/syntax/graphql.yaml +47 -0
  113. package/runtime/syntax/groff.yaml +30 -0
  114. package/runtime/syntax/groovy.yaml +111 -0
  115. package/runtime/syntax/haml.yaml +16 -0
  116. package/runtime/syntax/hare.yaml +52 -0
  117. package/runtime/syntax/haskell.yaml +52 -0
  118. package/runtime/syntax/hc.yaml +52 -0
  119. package/runtime/syntax/html.yaml +70 -0
  120. package/runtime/syntax/html4.yaml +25 -0
  121. package/runtime/syntax/html5.yaml +25 -0
  122. package/runtime/syntax/ini.yaml +23 -0
  123. package/runtime/syntax/inputrc.yaml +14 -0
  124. package/runtime/syntax/java.yaml +37 -0
  125. package/runtime/syntax/javascript.yaml +124 -0
  126. package/runtime/syntax/jinja2.yaml +19 -0
  127. package/runtime/syntax/json.yaml +39 -0
  128. package/runtime/syntax/jsonnet.yaml +92 -0
  129. package/runtime/syntax/julia.yaml +57 -0
  130. package/runtime/syntax/justfile.yaml +40 -0
  131. package/runtime/syntax/keymap.yaml +27 -0
  132. package/runtime/syntax/kickstart.yaml +16 -0
  133. package/runtime/syntax/kotlin.yaml +66 -0
  134. package/runtime/syntax/kvlang.yaml +67 -0
  135. package/runtime/syntax/ledger.yaml +14 -0
  136. package/runtime/syntax/lfe.yaml +17 -0
  137. package/runtime/syntax/lilypond.yaml +26 -0
  138. package/runtime/syntax/lisp.yaml +17 -0
  139. package/runtime/syntax/log.yaml +92 -0
  140. package/runtime/syntax/lua.yaml +111 -0
  141. package/runtime/syntax/mail.yaml +25 -0
  142. package/runtime/syntax/makefile.yaml +38 -0
  143. package/runtime/syntax/man.yaml +12 -0
  144. package/runtime/syntax/markdown.yaml +49 -0
  145. package/runtime/syntax/mc.yaml +23 -0
  146. package/runtime/syntax/meson.yaml +51 -0
  147. package/runtime/syntax/micro.yaml +34 -0
  148. package/runtime/syntax/mpdconf.yaml +13 -0
  149. package/runtime/syntax/msbuild.yaml +6 -0
  150. package/runtime/syntax/nanorc.yaml +16 -0
  151. package/runtime/syntax/nftables.yaml +30 -0
  152. package/runtime/syntax/nginx.yaml +22 -0
  153. package/runtime/syntax/nim.yaml +27 -0
  154. package/runtime/syntax/nix.yaml +32 -0
  155. package/runtime/syntax/nu.yaml +114 -0
  156. package/runtime/syntax/objc.yaml +60 -0
  157. package/runtime/syntax/ocaml.yaml +43 -0
  158. package/runtime/syntax/octave.yaml +83 -0
  159. package/runtime/syntax/odin.yaml +64 -0
  160. package/runtime/syntax/pascal.yaml +45 -0
  161. package/runtime/syntax/patch.yaml +14 -0
  162. package/runtime/syntax/peg.yaml +16 -0
  163. package/runtime/syntax/perl.yaml +58 -0
  164. package/runtime/syntax/php.yaml +60 -0
  165. package/runtime/syntax/pkg-config.yaml +12 -0
  166. package/runtime/syntax/po.yaml +12 -0
  167. package/runtime/syntax/pony.yaml +37 -0
  168. package/runtime/syntax/pov.yaml +21 -0
  169. package/runtime/syntax/privoxy-action.yaml +14 -0
  170. package/runtime/syntax/privoxy-config.yaml +10 -0
  171. package/runtime/syntax/privoxy-filter.yaml +12 -0
  172. package/runtime/syntax/proto.yaml +40 -0
  173. package/runtime/syntax/prql.yaml +84 -0
  174. package/runtime/syntax/puppet.yaml +22 -0
  175. package/runtime/syntax/python2.yaml +60 -0
  176. package/runtime/syntax/python3.yaml +80 -0
  177. package/runtime/syntax/r.yaml +32 -0
  178. package/runtime/syntax/raku.yaml +42 -0
  179. package/runtime/syntax/reST.yaml +18 -0
  180. package/runtime/syntax/renpy.yaml +15 -0
  181. package/runtime/syntax/rpmspec.yaml +43 -0
  182. package/runtime/syntax/ruby.yaml +73 -0
  183. package/runtime/syntax/rust.yaml +78 -0
  184. package/runtime/syntax/sage.yaml +60 -0
  185. package/runtime/syntax/scad.yaml +53 -0
  186. package/runtime/syntax/scala.yaml +33 -0
  187. package/runtime/syntax/sed.yaml +13 -0
  188. package/runtime/syntax/sh.yaml +69 -0
  189. package/runtime/syntax/sls.yaml +15 -0
  190. package/runtime/syntax/smalltalk.yaml +55 -0
  191. package/runtime/syntax/solidity.yaml +41 -0
  192. package/runtime/syntax/sql.yaml +35 -0
  193. package/runtime/syntax/stata.yaml +67 -0
  194. package/runtime/syntax/svelte.yaml +27 -0
  195. package/runtime/syntax/swift.yaml +103 -0
  196. package/runtime/syntax/systemd.yaml +16 -0
  197. package/runtime/syntax/tcl.yaml +18 -0
  198. package/runtime/syntax/terraform.yaml +87 -0
  199. package/runtime/syntax/tex.yaml +32 -0
  200. package/runtime/syntax/toml.yaml +56 -0
  201. package/runtime/syntax/twig.yaml +55 -0
  202. package/runtime/syntax/typescript.yaml +49 -0
  203. package/runtime/syntax/v.yaml +80 -0
  204. package/runtime/syntax/vala.yaml +26 -0
  205. package/runtime/syntax/verilog.yaml +60 -0
  206. package/runtime/syntax/vhdl.yaml +37 -0
  207. package/runtime/syntax/vi.yaml +31 -0
  208. package/runtime/syntax/vue.yaml +64 -0
  209. package/runtime/syntax/xml.yaml +37 -0
  210. package/runtime/syntax/xresources.yaml +14 -0
  211. package/runtime/syntax/yaml.yaml +34 -0
  212. package/runtime/syntax/yum.yaml +12 -0
  213. package/runtime/syntax/zig.yaml +52 -0
  214. package/runtime/syntax/zscript.yaml +72 -0
  215. package/runtime/syntax/zsh.yaml +52 -0
  216. package/single-exe/README.md +80 -0
  217. package/single-exe/assetsHelper.js +90 -0
  218. package/single-exe/assetsLoader.mjs +85 -0
  219. package/single-exe/compiled.js +149 -0
  220. package/single-exe/entry.mjs +9 -0
  221. package/single-exe/packAssets.sh +7 -0
  222. package/src/buffer/backup.js +160 -0
  223. package/src/buffer/buffer.js +126 -0
  224. package/src/buffer/fixed3-codec.js +140 -0
  225. package/src/buffer/loc.js +38 -0
  226. package/src/buffer/message.js +29 -0
  227. package/src/config/clean.js +172 -0
  228. package/src/config/colorscheme.js +99 -0
  229. package/src/config/config.js +122 -0
  230. package/src/config/defaults.js +109 -0
  231. package/src/cui/rpc.mjs +259 -0
  232. package/src/cui/server.mjs +116 -0
  233. package/src/display/ansi-style.js +60 -0
  234. package/src/highlight/highlighter.js +243 -0
  235. package/src/highlight/parser.js +225 -0
  236. package/src/index.js +8009 -0
  237. package/src/lua/engine.js +71 -0
  238. package/src/platform/archive.js +50 -0
  239. package/src/platform/clipboard.js +278 -0
  240. package/src/platform/commands.js +137 -0
  241. package/src/plugins/js-bridge.js +983 -0
  242. package/src/plugins/manager.js +674 -0
  243. package/src/runtime/assets.js +90 -0
  244. package/src/runtime/compiled.js +25 -0
  245. package/src/runtime/encodings.js +10 -0
  246. package/src/runtime/registry.js +134 -0
  247. package/src/screen/cell-buffer.js +81 -0
  248. package/src/screen/events.js +263 -0
  249. package/src/screen/screen.js +142 -0
  250. package/src/screen/vt100.js +571 -0
  251. package/src/shell/shell.js +70 -0
  252. package/testapp.md +55 -0
  253. package/tests/backup.test.js +133 -0
  254. package/tests/cmphex3b64.js +95 -0
  255. package/tests/pty-demo.js +492 -0
  256. package/tests/wv-client.js +96 -0
  257. package/tui +5 -0
  258. package/wui +5 -0
@@ -0,0 +1,355 @@
1
+ # Keybindings
2
+
3
+ - bunmicro has a plethora of hotkeys that make it easy and powerful to use.
4
+
5
+ - Custom keybindings are not implemented in bunmicro for now
6
+ - For a list of actions like CursorUp
7
+ - Press Ctrl+E to show command prompt
8
+ - `> help actions`
9
+ - It is recommended to use jsplugins to register a command for such purposes
10
+ - Examples under runtime/jsplugins
11
+ - If you really wish to rebind keys, edit src/index.js and look for things like alt-d
12
+
13
+
14
+ - For a more user-friendly list with
15
+ explanations of what the default hotkeys are and what they do
16
+ - Press Ctrl+E to show command prompt
17
+ - `> help defaultkeys`
18
+ - a json formatted list of default keys is included at the end of this document
19
+
20
+
21
+ You can use Ctrl + arrows to move word by word (Alt + arrows for Mac). Alt + left and right
22
+ move the cursor to the start and end of the line (Ctrl + left/right for Mac), and Ctrl + up and down move the
23
+ cursor to the start and end of the buffer.
24
+
25
+ You can hold shift with all of these movement actions to select while moving.
26
+
27
+
28
+ ## Note for macOS
29
+ - By default, macOS terminals do not forward alt events and
30
+ instead insert unicode characters. To fix this, do the following:
31
+
32
+ * iTerm2: select `Esc+` for `Left Option Key` in `Preferences->Profiles->Keys`.
33
+ * Terminal.app: Enable `Use Option key as Meta key` in `Preferences->Profiles->Keyboard`.
34
+
35
+ ### iTerm2
36
+
37
+ In iTerm2, you can do this in `Preferences->Profiles->Keys` then click the
38
+ `+`, input your keybinding, and for the `Action` select `Send Escape Sequence`.
39
+ For the above example your would type `ctrlback` into the box (the `\x1b`) is
40
+ automatically sent by iTerm2.
41
+
42
+
43
+ ## Actions binding (not implemented)
44
+
45
+ The `StartOfTextToggle` and `SelectToStartOfTextToggle` actions toggle between
46
+ jumping to the start of the text (first) and start of the line.
47
+
48
+ The `CutLine` action cuts the current line and adds it to the previously cut
49
+ lines in the clipboard since the last paste (rather than just replaces the
50
+ clipboard contents with this line). So you can cut multiple, not necessarily
51
+ consecutive lines to the clipboard just by pressing `Ctrl-k` multiple times,
52
+ without selecting them. If you want the more traditional behavior i.e. just
53
+ rewrite the clipboard every time, you can use `CopyLine,DeleteLine` action
54
+ instead of `CutLine`.
55
+
56
+ You can also bind some mouse actions (these must be bound to mouse buttons)
57
+
58
+ ```
59
+ MousePress
60
+ MouseDrag
61
+ MouseRelease
62
+ MouseMultiCursor
63
+ ```
64
+
65
+ Here is the list of all possible keys you can bind:
66
+
67
+ ```
68
+ Up
69
+ Down
70
+ Right
71
+ Left
72
+ UpLeft
73
+ UpRight
74
+ DownLeft
75
+ DownRight
76
+ Center
77
+ PageUp
78
+ PageDown
79
+ Home
80
+ End
81
+ Insert
82
+ Delete
83
+ Help
84
+ Exit
85
+ Clear
86
+ Cancel
87
+ Print
88
+ Pause
89
+ Backtab
90
+ F1
91
+ F2
92
+ F3
93
+ F4
94
+ F5
95
+ F6
96
+ F7
97
+ F8
98
+ F9
99
+ F10
100
+ F11
101
+ F12
102
+ F13
103
+ F14
104
+ F15
105
+ F16
106
+ F17
107
+ F18
108
+ F19
109
+ F20
110
+ F21
111
+ F22
112
+ F23
113
+ F24
114
+ F25
115
+ F26
116
+ F27
117
+ F28
118
+ F29
119
+ F30
120
+ F31
121
+ F32
122
+ F33
123
+ F34
124
+ F35
125
+ F36
126
+ F37
127
+ F38
128
+ F39
129
+ F40
130
+ F41
131
+ F42
132
+ F43
133
+ F44
134
+ F45
135
+ F46
136
+ F47
137
+ F48
138
+ F49
139
+ F50
140
+ F51
141
+ F52
142
+ F53
143
+ F54
144
+ F55
145
+ F56
146
+ F57
147
+ F58
148
+ F59
149
+ F60
150
+ F61
151
+ F62
152
+ F63
153
+ F64
154
+ CtrlSpace
155
+ Ctrl-a
156
+ Ctrl-b
157
+ Ctrl-c
158
+ Ctrl-d
159
+ Ctrl-e
160
+ Ctrl-f
161
+ Ctrl-g
162
+ Ctrl-h
163
+ Ctrl-i
164
+ Ctrl-j
165
+ Ctrl-k
166
+ Ctrl-l
167
+ Ctrl-m
168
+ Ctrl-n
169
+ Ctrl-o
170
+ Ctrl-p
171
+ Ctrl-q
172
+ Ctrl-r
173
+ Ctrl-s
174
+ Ctrl-t
175
+ Ctrl-u
176
+ Ctrl-v
177
+ Ctrl-w
178
+ Ctrl-x
179
+ Ctrl-y
180
+ Ctrl-z
181
+ CtrlLeftSq
182
+ CtrlBackslash
183
+ CtrlRightSq
184
+ CtrlCarat
185
+ CtrlUnderscore
186
+ Backspace
187
+ OldBackspace
188
+ Tab
189
+ Esc
190
+ Escape
191
+ Enter
192
+ ```
193
+
194
+ You can also bind some mouse buttons (they may be bound to normal actions or
195
+ mouse actions)
196
+
197
+ ```
198
+ MouseLeft
199
+ MouseLeftDrag
200
+ MouseLeftRelease
201
+ MouseMiddle
202
+ MouseMiddleDrag
203
+ MouseMiddleRelease
204
+ MouseRight
205
+ MouseRightDrag
206
+ MouseRightRelease
207
+ MouseWheelUp
208
+ MouseWheelDown
209
+ MouseWheelLeft
210
+ MouseWheelRight
211
+ ```
212
+
213
+
214
+
215
+ # Default keybinding configuration.
216
+
217
+ A select few keybindings are different on MacOS compared to other
218
+ operating systems. This is because different OSes have different
219
+ conventions for text editing defaults.
220
+
221
+ ```json
222
+ {
223
+ "Up": "CursorUp",
224
+ "Down": "CursorDown",
225
+ "Right": "CursorRight",
226
+ "Left": "CursorLeft",
227
+ "ShiftUp": "SelectUp",
228
+ "ShiftDown": "SelectDown",
229
+ "ShiftLeft": "SelectLeft",
230
+ "ShiftRight": "SelectRight",
231
+ "AltLeft": "WordLeft", (Mac)
232
+ "AltRight": "WordRight", (Mac)
233
+ "AltUp": "MoveLinesUp",
234
+ "AltDown": "MoveLinesDown",
235
+ "CtrlShiftRight": "SelectWordRight",
236
+ "CtrlShiftLeft": "SelectWordLeft",
237
+ "AltLeft": "StartOfTextToggle",
238
+ "AltRight": "EndOfLine",
239
+ "AltShiftRight": "SelectWordRight", (Mac)
240
+ "AltShiftLeft": "SelectWordLeft", (Mac)
241
+ "CtrlLeft": "StartOfText", (Mac)
242
+ "CtrlRight": "EndOfLine", (Mac)
243
+ "AltShiftLeft": "SelectToStartOfTextToggle",
244
+ "CtrlShiftLeft": "SelectToStartOfTextToggle", (Mac)
245
+ "ShiftHome": "SelectToStartOfTextToggle",
246
+ "AltShiftRight": "SelectToEndOfLine",
247
+ "CtrlShiftRight": "SelectToEndOfLine", (Mac)
248
+ "ShiftEnd": "SelectToEndOfLine",
249
+ "CtrlUp": "CursorStart",
250
+ "CtrlDown": "CursorEnd",
251
+ "CtrlShiftUp": "SelectToStart",
252
+ "CtrlShiftDown": "SelectToEnd",
253
+ "Alt-{": "ParagraphPrevious",
254
+ "Alt-}": "ParagraphNext",
255
+ "Enter": "InsertNewline",
256
+ "Ctrl-h": "Backspace",
257
+ "Backspace": "Backspace",
258
+ "Alt-CtrlH": "DeleteWordLeft",
259
+ "Alt-Backspace": "DeleteWordLeft",
260
+ "Tab": "Autocomplete|IndentSelection|InsertTab",
261
+ "Backtab": "OutdentSelection|OutdentLine",
262
+ "Ctrl-o": "OpenFile",
263
+ "Ctrl-s": "Save",
264
+ "Ctrl-f": "Find",
265
+ "Alt-F": "FindLiteral",
266
+ "Ctrl-n": "FindNext",
267
+ "Ctrl-p": "FindPrevious",
268
+ "Alt-[": "DiffPrevious|CursorStart",
269
+ "Alt-]": "DiffNext|CursorEnd",
270
+ "Ctrl-z": "Undo",
271
+ "Ctrl-y": "Redo",
272
+ "Ctrl-c": "Copy|CopyLine",
273
+ "Ctrl-x": "Cut|CutLine",
274
+ "Ctrl-k": "CutLine",
275
+ "Ctrl-d": "Duplicate|DuplicateLine",
276
+ "Ctrl-v": "Paste",
277
+ "Ctrl-a": "SelectAll",
278
+ "Ctrl-t": "AddTab",
279
+ "Alt-,": "PreviousTab|LastTab",
280
+ "Alt-.": "NextTab|FirstTab",
281
+ "Home": "StartOfText",
282
+ "End": "EndOfLine",
283
+ "CtrlHome": "CursorStart",
284
+ "CtrlEnd": "CursorEnd",
285
+ "PageUp": "CursorPageUp",
286
+ "PageDown": "CursorPageDown",
287
+ "CtrlPageUp": "PreviousTab|LastTab",
288
+ "CtrlPageDown": "NextTab|FirstTab",
289
+ "ShiftPageUp": "SelectPageUp",
290
+ "ShiftPageDown": "SelectPageDown",
291
+ "Ctrl-g": "ToggleHelp",
292
+ "Alt-g": "ToggleKeyMenu",
293
+ "Ctrl-r": "ToggleRuler",
294
+ "Ctrl-l": "command-edit:goto ",
295
+ "Delete": "Delete",
296
+ "Ctrl-b": "ShellMode",
297
+ "Ctrl-q": "Quit",
298
+ "Ctrl-e": "CommandMode",
299
+ "Ctrl-w": "NextSplit|FirstSplit",
300
+
301
+
302
+ // macro insert
303
+ // not implemented yet
304
+ "Ctrl-u": "ToggleMacro",
305
+ "Ctrl-j": "PlayMacro",
306
+ "Insert": "ToggleOverwriteMode",
307
+
308
+
309
+ // Emacs-style keybindings
310
+ // not implemented yet
311
+ "Alt-f": "WordRight",
312
+ "Alt-b": "WordLeft",
313
+ "Alt-a": "StartOfLine",
314
+ "Alt-e": "EndOfLine",
315
+
316
+ // Integration with file managers
317
+ // not implemented yet
318
+ "F2": "Save",
319
+ "F3": "Find",
320
+ "F4": "Quit",
321
+ "F7": "Find",
322
+ "F10": "Quit",
323
+ "Esc": "Escape",
324
+
325
+ // Mouse bindings
326
+ "MouseWheelUp": "ScrollUp",
327
+ "MouseWheelDown": "ScrollDown",
328
+ "MouseLeft": "MousePress",
329
+ "MouseLeftDrag": "MouseDrag",
330
+ "MouseLeftRelease": "MouseRelease",
331
+ "MouseMiddle": "PastePrimary",
332
+ "Ctrl-MouseLeft": "MouseMultiCursor",
333
+
334
+ // Multi-cursor bindings
335
+ // not implemented yet
336
+ "Alt-n": "SpawnMultiCursor",
337
+ "AltShiftUp": "SpawnMultiCursorUp",
338
+ "AltShiftDown": "SpawnMultiCursorDown",
339
+ "Alt-m": "SpawnMultiCursorSelect",
340
+ "Alt-p": "RemoveMultiCursor",
341
+ "Alt-c": "RemoveAllMultiCursors",
342
+ "Alt-x": "SkipMultiCursor",
343
+ }
344
+ ```
345
+
346
+
347
+ ## Final notes
348
+
349
+ - Note: On some old terminal emulators and on Windows machines, `Ctrl-h` should be used for backspace.
350
+
351
+ - Please note that terminal emulators are strange applications and micro only receives key events that the terminal decides to send.
352
+ - Some terminal emulators may not send certain events even if this document says micro can receive the event.
353
+ - To see exactly what micro receives from the terminal when you press a key,
354
+ - Press Ctrl+E to show command prompt
355
+ - then run the `> raw` command.
@@ -0,0 +1,90 @@
1
+ # Linter
2
+
3
+ The linter plugin runs a compiler or linter on your source code
4
+ and parses the resulting output so that the messages and line numbers
5
+ can be viewed from within micro. By default, the plugin supports the
6
+ following filetypes and linters:
7
+
8
+ * **c**: gcc
9
+ * **c++**: g++
10
+ * **d**: dmd
11
+ * **d**: ldc2
12
+ * **d**: gdc
13
+ * **go**: go build
14
+ * **go**: go vet
15
+ * **haskell**: hlint
16
+ * **java**: javac
17
+ * **javascript**: jshint
18
+ * **javascript**: eslint
19
+ * **literate**: lit
20
+ * **lua**: luacheck
21
+ * **nim**: nim
22
+ * **nix**: nix-linter
23
+ * **objective-c**: clang
24
+ * **python**: flake8
25
+ * **python**: mypy
26
+ * **python**: pyflakes
27
+ * **python**: pylint
28
+ * **python**: ruff
29
+ * **rust**: cargo clippy
30
+ * **shell**: shfmt
31
+ * **shell**: shellcheck
32
+ * **swift**: swiftc (MacOS and Linux only)
33
+ * **yaml**: yamllint
34
+
35
+ If the linter plugin is enabled and the file corresponds to one of
36
+ these filetypes, each time the buffer is saved, or when the `> lint`
37
+ command is executed, micro will run the corresponding utility in the
38
+ background and display the messages when it completes.
39
+
40
+ The linter plugin also allows users to extend the supported filetypes.
41
+ From inside another micro plugin, the function `linter.makeLinter` can
42
+ be called to register a new filetype. Here is the spec for the `makeLinter`
43
+ function:
44
+
45
+ `linter.makeLinter(name, filetype, cmd, args, errorformat, os, whitelist, domatch, loffset, coffset, callback)`
46
+
47
+ * **name**: name of the linter
48
+ * **filetype**: filetype to check for to use linter
49
+ * **cmd**: main linter process that is executed
50
+ * **args**: arguments to pass to the linter process
51
+ * use %f to refer to the current file name
52
+ * use %d to refer to the current directory name
53
+ * **errorformat**: how to parse the linter/compiler process output
54
+ %f: file, %l: line number, %m: error/warning message
55
+ * **os**: list of OSs this linter is supported or unsupported on
56
+ optional param, default: {}
57
+ * **whitelist**: should the OS list be a blacklist (do not run the linter for these OSs)
58
+ or a whitelist (only run the linter for these OSs)
59
+ optional param, default: false (should blacklist)
60
+ * **domatch**: should the filetype be interpreted as a lua pattern to match with
61
+ the actual filetype, or should the linter only activate on an exact match
62
+ optional param, default: false (require exact match)
63
+ * **loffset**: line offset will be added to the line number returned by the linter
64
+ useful if the linter returns 0-indexed lines
65
+ optional param, default: 0
66
+ * **coffset**: column offset will be added to the col number returned by the linter
67
+ useful if the linter returns 0-indexed columns
68
+ optional param, default: 0
69
+ * **callback**: function to call before executing the linter, if it returns
70
+ false the lint is canceled. The callback is passed the buf.
71
+ optional param, default: nil
72
+
73
+ Below is an example for including a linter for any filetype using
74
+ the `misspell` linter which checks for misspelled words in a file.
75
+
76
+ ```lua
77
+ function init()
78
+ -- uses the default linter plugin
79
+ -- matches any filetype
80
+ linter.makeLinter("misspell", "", "misspell", {"%f"}, "%f:%l:%c: %m", {}, false, true)
81
+ end
82
+ ```
83
+
84
+ Here is an example for a more typical use-case, where the linter will only match one filetype (C in this case):
85
+
86
+ ```lua
87
+ function init()
88
+ linter.makeLinter("gcc", "c", "gcc", {"-fsyntax-only", "-Wall", "-Wextra", "%f"}, "%f:%l:%c:.+: %m")
89
+ end
90
+ ```