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,760 @@
1
+ # Keybindings
2
+
3
+ Micro has a plethora of hotkeys that make it easy and powerful to use and all
4
+ hotkeys are fully customizable to your liking.
5
+
6
+ Custom keybindings are stored internally in micro if changed with the `> bind`
7
+ command or can also be added in the file `~/.config/micro/bindings.json` as
8
+ discussed below. For a list of the default keybindings in the json format used
9
+ by micro, please see the end of this file. For a more user-friendly list with
10
+ explanations of what the default hotkeys are and what they do, please see
11
+ `> help defaultkeys` (a json formatted list of default keys is included
12
+ at the end of this document).
13
+
14
+ If `~/.config/micro/bindings.json` does not exist, you can simply create it.
15
+ Micro will know what to do with it.
16
+
17
+ You can use Ctrl + arrows to move word by word (Alt + arrows for Mac). Alt + left and right
18
+ move the cursor to the start and end of the line (Ctrl + left/right for Mac), and Ctrl + up and down move the
19
+ cursor to the start and end of the buffer.
20
+
21
+ You can hold shift with all of these movement actions to select while moving.
22
+
23
+ ## Rebinding keys
24
+
25
+ The bindings may be rebound using the `~/.config/micro/bindings.json` file.
26
+ Each key is bound to an action.
27
+
28
+ For example, to bind `Ctrl-y` to undo and `Ctrl-z` to redo, you could put the
29
+ following in the `bindings.json` file.
30
+
31
+ ```json
32
+ {
33
+ "Ctrl-y": "Undo",
34
+ "Ctrl-z": "Redo"
35
+ }
36
+ ```
37
+
38
+ **Note:** The syntax `<Modifier><key>` is equivalent to `<Modifier>-<key>`. In
39
+ addition, `Ctrl-Shift` bindings are not supported by terminals, and are the same
40
+ as simply `Ctrl` bindings. This means that `CtrlG`, `Ctrl-G`, and `Ctrl-g` all
41
+ mean the same thing. However, for `Alt` this is not the case: `AltG` and `Alt-G`
42
+ mean `Alt-Shift-g`, while `Alt-g` does not require the Shift modifier.
43
+
44
+ In addition to editing your `~/.config/micro/bindings.json`, you can run
45
+ `>bind <keycombo> <action>` For a list of bindable actions, see below.
46
+
47
+ You can also chain commands when rebinding. For example, if you want `Alt-s` to
48
+ save and quit you can bind it like so:
49
+
50
+ ```json
51
+ {
52
+ "Alt-s": "Save,Quit"
53
+ }
54
+ ```
55
+
56
+ Each action will return a success flag. Actions can be chained such that
57
+ the chain only continues when there are successes, or failures, or either.
58
+ The `,` separator will always chain to the next action. The `|` separator
59
+ will abort the chain if the action preceding it succeeds, and the `&` will
60
+ abort the chain if the action preceding it fails. For example, in the default
61
+ bindings, tab is bound as
62
+
63
+ ```
64
+ "Tab": "Autocomplete|IndentSelection|InsertTab"
65
+ ```
66
+
67
+ This means that if the `Autocomplete` action is successful, the chain will
68
+ abort. Otherwise, it will try `IndentSelection`, and if that fails too, it
69
+ will execute `InsertTab`. To use `,`, `|` or `&` in an action (as an argument
70
+ to a command, for example), escape it with `\` or wrap it in single or double
71
+ quotes.
72
+
73
+ If the action has an `onAction` lua callback, for example `onAutocomplete` (see
74
+ `> help plugins`), then the action is only considered successful if the action
75
+ itself succeeded *and* the callback returned true. If there are multiple
76
+ `onAction` callbacks for this action, registered by multiple plugins, then the
77
+ action is only considered successful if the action itself succeeded and all the
78
+ callbacks returned true.
79
+
80
+ ## Binding commands
81
+
82
+ You can also bind a key to execute a command in command mode (see
83
+ `help commands`). Simply prepend the binding with `command:`. For example:
84
+
85
+ ```json
86
+ {
87
+ "Alt-p": "command:pwd"
88
+ }
89
+ ```
90
+
91
+ **Note for macOS**: By default, macOS terminals do not forward alt events and
92
+ instead insert unicode characters. To fix this, do the following:
93
+
94
+ * iTerm2: select `Esc+` for `Left Option Key` in `Preferences->Profiles->Keys`.
95
+ * Terminal.app: Enable `Use Option key as Meta key` in `Preferences->Profiles->Keyboard`.
96
+
97
+ Now when you press `Alt-p` the `pwd` command will be executed which will show
98
+ your working directory in the infobar.
99
+
100
+ You can also bind an "editable" command with `command-edit:`. This means that
101
+ micro won't immediately execute the command when you press the binding, but
102
+ instead just place the string in the infobar in command mode. For example,
103
+ you could rebind `Ctrl-g` to `> help`:
104
+
105
+ ```json
106
+ {
107
+ "Ctrl-g": "command-edit:help "
108
+ }
109
+ ```
110
+
111
+ Now when you press `Ctrl-g`, `help` will appear in the command bar and your
112
+ cursor will be placed after it (note the space in the json that controls the
113
+ cursor placement).
114
+
115
+ ## Binding Lua functions
116
+
117
+ You can also bind a key to a Lua function provided by a plugin, or by your own
118
+ `~/.config/micro/init.lua`. For example:
119
+
120
+ ```json
121
+ {
122
+ "Alt-q": "lua:foo.bar"
123
+ }
124
+ ```
125
+
126
+ where `foo` is the name of the plugin and `bar` is the name of the lua function
127
+ in it, e.g.:
128
+
129
+ ```lua
130
+ local micro = import("micro")
131
+
132
+ function bar(bp)
133
+ micro.InfoBar():Message("Bar action triggered")
134
+ return true
135
+ end
136
+ ```
137
+
138
+ See `> help plugins` for more informations on how to write lua functions.
139
+
140
+ For `~/.config/micro/init.lua` the plugin name is `initlua` (so the keybinding
141
+ in this example would be `"Alt-q": "lua:initlua.bar"`).
142
+
143
+ The currently active bufpane is passed to the lua function as the argument. If
144
+ the key is a mouse button, e.g. `MouseLeft` or `MouseWheelUp`, the mouse event
145
+ info is passed to the lua function as the second argument, of type
146
+ `*tcell.EventMouse`. See https://pkg.go.dev/github.com/micro-editor/tcell/v2#EventMouse
147
+ for the description of this type and its methods.
148
+
149
+ The return value of the lua function defines whether the action has succeeded.
150
+ This is used when chaining lua functions with other actions. They can be chained
151
+ the same way as regular actions as described above, for example:
152
+
153
+ ```
154
+ "Alt-q": "lua:initlua.bar|Quit"
155
+ ```
156
+
157
+ ## Binding raw escape sequences
158
+
159
+ Only read this section if you are interested in binding keys that aren't on the
160
+ list of supported keys for binding.
161
+
162
+ One of the drawbacks of using a terminal-based editor is that the editor must
163
+ get all of its information about key events through the terminal. The terminal
164
+ sends these events in the form of escape sequences often (but not always)
165
+ starting with `0x1b`.
166
+
167
+ For example, if micro reads `\x1b[1;5D`, on most terminals this will mean the
168
+ user pressed CtrlLeft.
169
+
170
+ For many key chords though, the terminal won't send any escape code or will
171
+ send an escape code already in use. For example for `CtrlBackspace`, my
172
+ terminal sends `\u007f` (note this doesn't start with `0x1b`), which it also
173
+ sends for `Backspace` meaning micro can't bind `CtrlBackspace`.
174
+
175
+ However, some terminals do allow you to bind keys to send specific escape
176
+ sequences you define. Then from micro you can directly bind those escape
177
+ sequences to actions. For example, to bind `CtrlBackspace` you can instruct
178
+ your terminal to send `\x1bctrlback` and then bind it in `bindings.json`:
179
+
180
+ ```json
181
+ {
182
+ "\u001bctrlback": "DeleteWordLeft"
183
+ }
184
+ ```
185
+
186
+ Here are some instructions for sending raw escapes in different terminals
187
+
188
+ ### iTerm2
189
+
190
+ In iTerm2, you can do this in `Preferences->Profiles->Keys` then click the
191
+ `+`, input your keybinding, and for the `Action` select `Send Escape Sequence`.
192
+ For the above example your would type `ctrlback` into the box (the `\x1b`) is
193
+ automatically sent by iTerm2.
194
+
195
+ ### Linux using loadkeys
196
+
197
+ You can do this in linux using the loadkeys program.
198
+
199
+ Coming soon!
200
+
201
+ ## Unbinding keys
202
+
203
+ It is also possible to disable any of the default key bindings by use of the
204
+ `None` action in the user's `bindings.json` file.
205
+
206
+ ## Bindable actions and bindable keys
207
+
208
+ The list of default keybindings contains most of the possible actions and keys
209
+ which you can use, but not all of them. Here is a full list of both.
210
+
211
+ Full list of possible actions:
212
+
213
+ ```
214
+ CursorUp
215
+ CursorDown
216
+ CursorPageUp
217
+ CursorPageDown
218
+ CursorLeft
219
+ CursorRight
220
+ CursorStart
221
+ CursorEnd
222
+ CursorToViewTop
223
+ CursorToViewCenter
224
+ CursorToViewBottom
225
+ SelectToStart
226
+ SelectToEnd
227
+ SelectUp
228
+ SelectDown
229
+ SelectLeft
230
+ SelectRight
231
+ WordRight
232
+ WordLeft
233
+ SubWordRight
234
+ SubWordLeft
235
+ SelectWordRight
236
+ SelectWordLeft
237
+ SelectSubWordRight
238
+ SelectSubWordLeft
239
+ DeleteWordRight
240
+ DeleteWordLeft
241
+ DeleteSubWordRight
242
+ DeleteSubWordLeft
243
+ SelectLine
244
+ SelectToStartOfLine
245
+ SelectToStartOfText
246
+ SelectToStartOfTextToggle
247
+ SelectToEndOfLine
248
+ ParagraphPrevious
249
+ ParagraphNext
250
+ SelectToParagraphPrevious
251
+ SelectToParagraphNext
252
+ InsertNewline
253
+ Backspace
254
+ Delete
255
+ InsertTab
256
+ Save
257
+ SaveAll
258
+ SaveAs
259
+ Find
260
+ FindLiteral
261
+ FindNext
262
+ FindPrevious
263
+ DiffNext
264
+ DiffPrevious
265
+ Center
266
+ Undo
267
+ Redo
268
+ Copy
269
+ CopyLine
270
+ Cut
271
+ CutLine
272
+ Duplicate
273
+ DuplicateLine
274
+ DeleteLine
275
+ MoveLinesUp
276
+ MoveLinesDown
277
+ IndentSelection
278
+ OutdentSelection
279
+ Autocomplete
280
+ CycleAutocompleteBack
281
+ OutdentLine
282
+ IndentLine
283
+ Paste
284
+ PastePrimary
285
+ SelectAll
286
+ OpenFile
287
+ Start
288
+ End
289
+ PageUp
290
+ PageDown
291
+ SelectPageUp
292
+ SelectPageDown
293
+ HalfPageUp
294
+ HalfPageDown
295
+ StartOfText
296
+ StartOfTextToggle
297
+ StartOfLine
298
+ EndOfLine
299
+ ToggleHelp
300
+ ToggleKeyMenu
301
+ ToggleDiffGutter
302
+ ToggleRuler
303
+ ToggleHighlightSearch
304
+ UnhighlightSearch
305
+ ResetSearch
306
+ ClearStatus
307
+ ShellMode
308
+ CommandMode
309
+ ToggleOverwriteMode
310
+ Escape
311
+ Quit
312
+ QuitAll
313
+ ForceQuit
314
+ AddTab
315
+ PreviousTab
316
+ NextTab
317
+ FirstTab
318
+ LastTab
319
+ NextSplit
320
+ PreviousSplit
321
+ FirstSplit
322
+ LastSplit
323
+ Unsplit
324
+ VSplit
325
+ HSplit
326
+ ToggleMacro
327
+ PlayMacro
328
+ Suspend (Unix only)
329
+ ScrollUp
330
+ ScrollDown
331
+ SpawnMultiCursor
332
+ SpawnMultiCursorUp
333
+ SpawnMultiCursorDown
334
+ SpawnMultiCursorSelect
335
+ RemoveMultiCursor
336
+ RemoveAllMultiCursors
337
+ SkipMultiCursor
338
+ SkipMultiCursorBack
339
+ JumpToMatchingBrace
340
+ JumpLine
341
+ Deselect
342
+ ClearInfo
343
+ None
344
+ ```
345
+
346
+ The `StartOfTextToggle` and `SelectToStartOfTextToggle` actions toggle between
347
+ jumping to the start of the text (first) and start of the line.
348
+
349
+ The `CutLine` action cuts the current line and adds it to the previously cut
350
+ lines in the clipboard since the last paste (rather than just replaces the
351
+ clipboard contents with this line). So you can cut multiple, not necessarily
352
+ consecutive lines to the clipboard just by pressing `Ctrl-k` multiple times,
353
+ without selecting them. If you want the more traditional behavior i.e. just
354
+ rewrite the clipboard every time, you can use `CopyLine,DeleteLine` action
355
+ instead of `CutLine`.
356
+
357
+ You can also bind some mouse actions (these must be bound to mouse buttons)
358
+
359
+ ```
360
+ MousePress
361
+ MouseDrag
362
+ MouseRelease
363
+ MouseMultiCursor
364
+ ```
365
+
366
+ Here is the list of all possible keys you can bind:
367
+
368
+ ```
369
+ Up
370
+ Down
371
+ Right
372
+ Left
373
+ UpLeft
374
+ UpRight
375
+ DownLeft
376
+ DownRight
377
+ Center
378
+ PageUp
379
+ PageDown
380
+ Home
381
+ End
382
+ Insert
383
+ Delete
384
+ Help
385
+ Exit
386
+ Clear
387
+ Cancel
388
+ Print
389
+ Pause
390
+ Backtab
391
+ F1
392
+ F2
393
+ F3
394
+ F4
395
+ F5
396
+ F6
397
+ F7
398
+ F8
399
+ F9
400
+ F10
401
+ F11
402
+ F12
403
+ F13
404
+ F14
405
+ F15
406
+ F16
407
+ F17
408
+ F18
409
+ F19
410
+ F20
411
+ F21
412
+ F22
413
+ F23
414
+ F24
415
+ F25
416
+ F26
417
+ F27
418
+ F28
419
+ F29
420
+ F30
421
+ F31
422
+ F32
423
+ F33
424
+ F34
425
+ F35
426
+ F36
427
+ F37
428
+ F38
429
+ F39
430
+ F40
431
+ F41
432
+ F42
433
+ F43
434
+ F44
435
+ F45
436
+ F46
437
+ F47
438
+ F48
439
+ F49
440
+ F50
441
+ F51
442
+ F52
443
+ F53
444
+ F54
445
+ F55
446
+ F56
447
+ F57
448
+ F58
449
+ F59
450
+ F60
451
+ F61
452
+ F62
453
+ F63
454
+ F64
455
+ CtrlSpace
456
+ Ctrl-a
457
+ Ctrl-b
458
+ Ctrl-c
459
+ Ctrl-d
460
+ Ctrl-e
461
+ Ctrl-f
462
+ Ctrl-g
463
+ Ctrl-h
464
+ Ctrl-i
465
+ Ctrl-j
466
+ Ctrl-k
467
+ Ctrl-l
468
+ Ctrl-m
469
+ Ctrl-n
470
+ Ctrl-o
471
+ Ctrl-p
472
+ Ctrl-q
473
+ Ctrl-r
474
+ Ctrl-s
475
+ Ctrl-t
476
+ Ctrl-u
477
+ Ctrl-v
478
+ Ctrl-w
479
+ Ctrl-x
480
+ Ctrl-y
481
+ Ctrl-z
482
+ CtrlLeftSq
483
+ CtrlBackslash
484
+ CtrlRightSq
485
+ CtrlCarat
486
+ CtrlUnderscore
487
+ Backspace
488
+ OldBackspace
489
+ Tab
490
+ Esc
491
+ Escape
492
+ Enter
493
+ ```
494
+
495
+ You can also bind some mouse buttons (they may be bound to normal actions or
496
+ mouse actions)
497
+
498
+ ```
499
+ MouseLeft
500
+ MouseLeftDrag
501
+ MouseLeftRelease
502
+ MouseMiddle
503
+ MouseMiddleDrag
504
+ MouseMiddleRelease
505
+ MouseRight
506
+ MouseRightDrag
507
+ MouseRightRelease
508
+ MouseWheelUp
509
+ MouseWheelDown
510
+ MouseWheelLeft
511
+ MouseWheelRight
512
+ ```
513
+
514
+ ## Key sequences
515
+
516
+ Key sequences can be bound by specifying valid keys one after another in brackets, such
517
+ as `<Ctrl-x><Ctrl-c>`.
518
+
519
+ # Default keybinding configuration.
520
+
521
+ A select few keybindings are different on MacOS compared to other
522
+ operating systems. This is because different OSes have different
523
+ conventions for text editing defaults.
524
+
525
+ ```json
526
+ {
527
+ "Up": "CursorUp",
528
+ "Down": "CursorDown",
529
+ "Right": "CursorRight",
530
+ "Left": "CursorLeft",
531
+ "ShiftUp": "SelectUp",
532
+ "ShiftDown": "SelectDown",
533
+ "ShiftLeft": "SelectLeft",
534
+ "ShiftRight": "SelectRight",
535
+ "AltLeft": "WordLeft", (Mac)
536
+ "AltRight": "WordRight", (Mac)
537
+ "AltUp": "MoveLinesUp",
538
+ "AltDown": "MoveLinesDown",
539
+ "CtrlShiftRight": "SelectWordRight",
540
+ "CtrlShiftLeft": "SelectWordLeft",
541
+ "AltLeft": "StartOfTextToggle",
542
+ "AltRight": "EndOfLine",
543
+ "AltShiftRight": "SelectWordRight", (Mac)
544
+ "AltShiftLeft": "SelectWordLeft", (Mac)
545
+ "CtrlLeft": "StartOfText", (Mac)
546
+ "CtrlRight": "EndOfLine", (Mac)
547
+ "AltShiftLeft": "SelectToStartOfTextToggle",
548
+ "CtrlShiftLeft": "SelectToStartOfTextToggle", (Mac)
549
+ "ShiftHome": "SelectToStartOfTextToggle",
550
+ "AltShiftRight": "SelectToEndOfLine",
551
+ "CtrlShiftRight": "SelectToEndOfLine", (Mac)
552
+ "ShiftEnd": "SelectToEndOfLine",
553
+ "CtrlUp": "CursorStart",
554
+ "CtrlDown": "CursorEnd",
555
+ "CtrlShiftUp": "SelectToStart",
556
+ "CtrlShiftDown": "SelectToEnd",
557
+ "Alt-{": "ParagraphPrevious",
558
+ "Alt-}": "ParagraphNext",
559
+ "Enter": "InsertNewline",
560
+ "Ctrl-h": "Backspace",
561
+ "Backspace": "Backspace",
562
+ "Alt-CtrlH": "DeleteWordLeft",
563
+ "Alt-Backspace": "DeleteWordLeft",
564
+ "Tab": "Autocomplete|IndentSelection|InsertTab",
565
+ "Backtab": "OutdentSelection|OutdentLine",
566
+ "Ctrl-o": "OpenFile",
567
+ "Ctrl-s": "Save",
568
+ "Ctrl-f": "Find",
569
+ "Alt-F": "FindLiteral",
570
+ "Ctrl-n": "FindNext",
571
+ "Ctrl-p": "FindPrevious",
572
+ "Alt-[": "DiffPrevious|CursorStart",
573
+ "Alt-]": "DiffNext|CursorEnd",
574
+ "Ctrl-z": "Undo",
575
+ "Ctrl-y": "Redo",
576
+ "Ctrl-c": "Copy|CopyLine",
577
+ "Ctrl-x": "Cut|CutLine",
578
+ "Ctrl-k": "CutLine",
579
+ "Ctrl-d": "Duplicate|DuplicateLine",
580
+ "Ctrl-v": "Paste",
581
+ "Ctrl-a": "SelectAll",
582
+ "Ctrl-t": "AddTab",
583
+ "Alt-,": "PreviousTab|LastTab",
584
+ "Alt-.": "NextTab|FirstTab",
585
+ "Home": "StartOfText",
586
+ "End": "EndOfLine",
587
+ "CtrlHome": "CursorStart",
588
+ "CtrlEnd": "CursorEnd",
589
+ "PageUp": "CursorPageUp",
590
+ "PageDown": "CursorPageDown",
591
+ "CtrlPageUp": "PreviousTab|LastTab",
592
+ "CtrlPageDown": "NextTab|FirstTab",
593
+ "ShiftPageUp": "SelectPageUp",
594
+ "ShiftPageDown": "SelectPageDown",
595
+ "Ctrl-g": "ToggleHelp",
596
+ "Alt-g": "ToggleKeyMenu",
597
+ "Ctrl-r": "ToggleRuler",
598
+ "Ctrl-l": "command-edit:goto ",
599
+ "Delete": "Delete",
600
+ "Ctrl-b": "ShellMode",
601
+ "Ctrl-q": "Quit",
602
+ "Ctrl-e": "CommandMode",
603
+ "Ctrl-w": "NextSplit|FirstSplit",
604
+ "Ctrl-u": "ToggleMacro",
605
+ "Ctrl-j": "PlayMacro",
606
+ "Insert": "ToggleOverwriteMode",
607
+
608
+ // Emacs-style keybindings
609
+ "Alt-f": "WordRight",
610
+ "Alt-b": "WordLeft",
611
+ "Alt-a": "StartOfLine",
612
+ "Alt-e": "EndOfLine",
613
+
614
+ // Integration with file managers
615
+ "F2": "Save",
616
+ "F3": "Find",
617
+ "F4": "Quit",
618
+ "F7": "Find",
619
+ "F10": "Quit",
620
+ "Esc": "Escape",
621
+
622
+ // Mouse bindings
623
+ "MouseWheelUp": "ScrollUp",
624
+ "MouseWheelDown": "ScrollDown",
625
+ "MouseLeft": "MousePress",
626
+ "MouseLeftDrag": "MouseDrag",
627
+ "MouseLeftRelease": "MouseRelease",
628
+ "MouseMiddle": "PastePrimary",
629
+ "Ctrl-MouseLeft": "MouseMultiCursor",
630
+
631
+ // Multi-cursor bindings
632
+ "Alt-n": "SpawnMultiCursor",
633
+ "AltShiftUp": "SpawnMultiCursorUp",
634
+ "AltShiftDown": "SpawnMultiCursorDown",
635
+ "Alt-m": "SpawnMultiCursorSelect",
636
+ "Alt-p": "RemoveMultiCursor",
637
+ "Alt-c": "RemoveAllMultiCursors",
638
+ "Alt-x": "SkipMultiCursor",
639
+ }
640
+ ```
641
+
642
+ ## Pane type bindings
643
+
644
+ Keybindings can be specified for different pane types as well. For example, to
645
+ make a binding that only affects the command bar, use the `command` subgroup:
646
+
647
+ ```
648
+ {
649
+ "command": {
650
+ "Ctrl-w": "WordLeft"
651
+ }
652
+ }
653
+ ```
654
+
655
+ The possible pane types are `buffer` (normal buffer), `command` (command bar),
656
+ and `terminal` (terminal pane). The defaults for the command and terminal panes
657
+ are given below:
658
+
659
+ ```
660
+ {
661
+ "terminal": {
662
+ "<Ctrl-q><Ctrl-q>": "Exit",
663
+ "<Ctrl-e><Ctrl-e>": "CommandMode",
664
+ "<Ctrl-w><Ctrl-w>": "NextSplit"
665
+ },
666
+
667
+ "command": {
668
+ "Up": "HistoryUp",
669
+ "Down": "HistoryDown",
670
+ "Right": "CursorRight",
671
+ "Left": "CursorLeft",
672
+ "ShiftUp": "SelectUp",
673
+ "ShiftDown": "SelectDown",
674
+ "ShiftLeft": "SelectLeft",
675
+ "ShiftRight": "SelectRight",
676
+ "AltLeft": "StartOfTextToggle",
677
+ "AltRight": "EndOfLine",
678
+ "AltUp": "CursorStart",
679
+ "AltDown": "CursorEnd",
680
+ "AltShiftRight": "SelectWordRight",
681
+ "AltShiftLeft": "SelectWordLeft",
682
+ "CtrlLeft": "WordLeft",
683
+ "CtrlRight": "WordRight",
684
+ "CtrlShiftLeft": "SelectToStartOfTextToggle",
685
+ "ShiftHome": "SelectToStartOfTextToggle",
686
+ "CtrlShiftRight": "SelectToEndOfLine",
687
+ "ShiftEnd": "SelectToEndOfLine",
688
+ "CtrlUp": "CursorStart",
689
+ "CtrlDown": "CursorEnd",
690
+ "CtrlShiftUp": "SelectToStart",
691
+ "CtrlShiftDown": "SelectToEnd",
692
+ "Enter": "ExecuteCommand",
693
+ "CtrlH": "Backspace",
694
+ "Backspace": "Backspace",
695
+ "OldBackspace": "Backspace",
696
+ "Alt-CtrlH": "DeleteWordLeft",
697
+ "Alt-Backspace": "DeleteWordLeft",
698
+ "Tab": "CommandComplete",
699
+ "Backtab": "CycleAutocompleteBack",
700
+ "Ctrl-z": "Undo",
701
+ "Ctrl-y": "Redo",
702
+ "Ctrl-c": "Copy",
703
+ "Ctrl-x": "Cut",
704
+ "Ctrl-k": "CutLine",
705
+ "Ctrl-v": "Paste",
706
+ "Home": "StartOfTextToggle",
707
+ "End": "EndOfLine",
708
+ "CtrlHome": "CursorStart",
709
+ "CtrlEnd": "CursorEnd",
710
+ "Delete": "Delete",
711
+ "Ctrl-q": "AbortCommand",
712
+ "Ctrl-e": "EndOfLine",
713
+ "Ctrl-a": "StartOfLine",
714
+ "Ctrl-w": "DeleteWordLeft",
715
+ "Insert": "ToggleOverwriteMode",
716
+ "Ctrl-b": "WordLeft",
717
+ "Ctrl-f": "WordRight",
718
+ "Ctrl-d": "DeleteWordLeft",
719
+ "Ctrl-m": "ExecuteCommand",
720
+ "Ctrl-n": "HistoryDown",
721
+ "Ctrl-p": "HistoryUp",
722
+ "Ctrl-u": "SelectToStart",
723
+
724
+ // Emacs-style keybindings
725
+ "Alt-f": "WordRight",
726
+ "Alt-b": "WordLeft",
727
+ "Alt-a": "StartOfText",
728
+ "Alt-e": "EndOfLine",
729
+
730
+ // Integration with file managers
731
+ "F10": "AbortCommand",
732
+ "Esc": "AbortCommand",
733
+
734
+ // Mouse bindings
735
+ "MouseWheelUp": "HistoryUp",
736
+ "MouseWheelDown": "HistoryDown",
737
+ "MouseLeft": "MousePress",
738
+ "MouseLeftDrag": "MouseDrag",
739
+ "MouseLeftRelease": "MouseRelease",
740
+ "MouseMiddle": "PastePrimary"
741
+ }
742
+ }
743
+ ```
744
+
745
+ ## Final notes
746
+
747
+ Note: On some old terminal emulators and on Windows machines, `Ctrl-h` should be
748
+ used for backspace.
749
+
750
+ Additionally, alt keys can be bound by using `Alt-key`. For example `Alt-a` or
751
+ `Alt-Up`. Micro supports an optional `-` between modifiers like `Alt` and
752
+ `Ctrl` so `Alt-a` could be rewritten as `Alta` (case matters for alt bindings).
753
+ This is why in the default keybindings you can see `AltShiftLeft` instead of
754
+ `Alt-ShiftLeft` (they are equivalent).
755
+
756
+ Please note that terminal emulators are strange applications and micro only
757
+ receives key events that the terminal decides to send. Some terminal emulators
758
+ may not send certain events even if this document says micro can receive the
759
+ event. To see exactly what micro receives from the terminal when you press a
760
+ key, run the `> raw` command.