parse_keymap.lua 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. -- parse Lua modified keymap.clj into Markdown table
  2. local keymaps = {
  3. darwin = {
  4. ["A"] = "add",
  5. ["Alt+Backspace"] = "delete-prev-word",
  6. ["Alt+Delete"] = "delete-next-word",
  7. ["Alt+Down"] = "end-of-line",
  8. ["Alt+Down"] = "move-down",
  9. ["Alt+Left"] = "prev-word",
  10. ["Alt+Meta+E"] = "select-next-occurrence",
  11. ["Alt+Meta+F"] = "replace-text",
  12. ["Alt+Meta+G"] = "replace-next",
  13. ["Alt+Right"] = "next-word",
  14. ["Alt+Up"] = "beginning-of-line",
  15. ["Alt+Up"] = "move-up",
  16. ["Backspace"] = "delete-backward",
  17. ["Ctrl+A"] = "beginning-of-line",
  18. ["Ctrl+D"] = "delete-line",
  19. ["Ctrl+E"] = "end-of-line",
  20. ["Ctrl+I"] = "reindent",
  21. ["Ctrl+K"] = "delete-to-end-of-line",
  22. ["Ctrl+Meta+H"] = "toggle-component-guides",
  23. ["Ctrl+R"] = "reload-stylesheet",
  24. ["Ctrl+Space"] = "proposals",
  25. ["Delete"] = "delete",
  26. ["Down"] = "down",
  27. ["E"] = "rotate-tool",
  28. ["End"] = "end-of-line",
  29. ["Enter"] = "enter",
  30. ["Esc"] = "escape",
  31. ["F"] = "frame-selection",
  32. ["F1"] = "documentation",
  33. ["F10"] = "step-over",
  34. ["F11"] = "step-into",
  35. ["F2"] = "rename",
  36. ["F5"] = "start-debugger",
  37. ["F5"] = "continue",
  38. ["F6"] = "toggle-pane-left",
  39. ["F7"] = "toggle-pane-bottom",
  40. ["F8"] = "toggle-pane-right",
  41. ["F9"] = "toggle-breakpoint",
  42. ["Home"] = "beginning-of-line-text",
  43. ["Left"] = "left",
  44. ["Meta+'+'"] = "zoom-in",
  45. ["Meta+'-'"] = "zoom-out",
  46. ["Meta+A"] = "select-all",
  47. ["Meta+B"] = "build",
  48. ["Meta+C"] = "copy",
  49. ["Meta+Comma"] = "preferences",
  50. ["Meta+D"] = "select-next-occurrence",
  51. ["Meta+Delete"] = "delete-to-end-of-line",
  52. ["Meta+Down"] = "end-of-file",
  53. ["Meta+E"] = "hide-selected",
  54. ["Meta+F"] = "filter-form",
  55. ["Meta+F"] = "find-text",
  56. ["Meta+G"] = "find-next",
  57. ["Meta+L"] = "goto-line",
  58. ["Meta+Left"] = "beginning-of-line-text",
  59. ["Meta+N"] = "new-file",
  60. ["Meta+O"] = "open",
  61. ["Meta+P"] = "open-asset",
  62. ["Meta+Q"] = "quit",
  63. ["Meta+R"] = "hot-reload",
  64. ["Meta+Right"] = "end-of-line",
  65. ["Meta+S"] = "save-all",
  66. ["Meta+Slash"] = "toggle-comment",
  67. ["Meta+T"] = "scene-stop",
  68. ["Meta+U"] = "rebundle",
  69. ["Meta+Up"] = "beginning-of-file",
  70. ["Meta+V"] = "paste",
  71. ["Meta+W"] = "close",
  72. ["Meta+X"] = "cut",
  73. ["Meta+Z"] = "undo",
  74. ["Page Down"] = "page-down",
  75. ["Page Up"] = "page-up",
  76. ["Period"] = "realign-camera",
  77. ["R"] = "scale-tool",
  78. ["Right"] = "right",
  79. ["Shift+A"] = "add-secondary",
  80. ["Shift+Alt+Down"] = "select-end-of-line",
  81. ["Shift+Alt+Left"] = "select-prev-word",
  82. ["Shift+Alt+Right"] = "select-next-word",
  83. ["Shift+Alt+Up"] = "select-beginning-of-line",
  84. ["Shift+Ctrl+A"] = "select-beginning-of-line",
  85. ["Shift+Ctrl+E"] = "select-end-of-line",
  86. ["Shift+Ctrl+Left"] = "select-prev-word",
  87. ["Shift+Ctrl+Right"] = "select-next-word",
  88. ["Shift+Down"] = "down-major",
  89. ["Shift+Down"] = "select-down",
  90. ["Shift+E"] = "erase-tool",
  91. ["Shift+End"] = "select-end-of-line",
  92. ["Shift+F11"] = "step-out",
  93. ["Shift+Home"] = "select-beginning-of-line-text",
  94. ["Shift+Left"] = "left-major",
  95. ["Shift+Left"] = "select-left",
  96. ["Shift+Meta+B"] = "rebuild",
  97. ["Shift+Meta+Delete"] = "delete-to-end-of-line",
  98. ["Shift+Meta+Down"] = "select-end-of-file",
  99. ["Shift+Meta+E"] = "show-last-hidden",
  100. ["Shift+Meta+F"] = "search-in-files",
  101. ["Shift+Meta+G"] = "find-prev",
  102. ["Shift+Meta+I"] = "toggle-visibility-filters",
  103. ["Shift+Meta+L"] = "split-selection-into-lines",
  104. ["Shift+Meta+Left"] = "select-beginning-of-line-text",
  105. ["Shift+Meta+R"] = "open-asset",
  106. ["Shift+Meta+Right"] = "select-end-of-line",
  107. ["Shift+Meta+Up"] = "select-beginning-of-file",
  108. ["Shift+Meta+W"] = "close-all",
  109. ["Shift+Meta+Z"] = "redo",
  110. ["Shift+Page Down"] = "select-page-down",
  111. ["Shift+Page Up"] = "select-page-up",
  112. ["Shift+Right"] = "right-major",
  113. ["Shift+Right"] = "select-right",
  114. ["Shift+Tab"] = "backwards-tab-trigger",
  115. ["Shift+Up"] = "select-up",
  116. ["Shift+Up"] = "up-major",
  117. ["Space"] = "scene-play",
  118. ["Space"] = "show-palette",
  119. ["Tab"] = "tab",
  120. ["Up"] = "up",
  121. ["W"] = "move-tool",
  122. },
  123. win32 = {
  124. ["A"] = "add",
  125. ["Alt+Down"] = "move-down",
  126. ["Alt+Up"] = "move-up",
  127. ["Backspace"] = "delete-backward",
  128. ["Ctrl+'+'"] = "zoom-in",
  129. ["Ctrl+'-'"] = "zoom-out",
  130. ["Ctrl+A"] = "select-all",
  131. ["Ctrl+B"] = "build",
  132. ["Ctrl+Backspace"] = "delete-prev-word",
  133. ["Ctrl+C"] = "copy",
  134. ["Ctrl+Comma"] = "preferences",
  135. ["Ctrl+D"] = "select-next-occurrence",
  136. ["Ctrl+Delete"] = "delete-next-word",
  137. ["Ctrl+E"] = "hide-selected",
  138. ["Ctrl+End"] = "end-of-file",
  139. ["Ctrl+F"] = "filter-form",
  140. ["Ctrl+F"] = "find-text",
  141. ["Ctrl+G"] = "find-next",
  142. ["Ctrl+H"] = "replace-text",
  143. ["Ctrl+H"] = "toggle-component-guides",
  144. ["Ctrl+Home"] = "beginning-of-file",
  145. ["Ctrl+I"] = "reindent",
  146. ["Ctrl+K"] = "delete-to-end-of-line",
  147. ["Ctrl+L"] = "goto-line",
  148. ["Ctrl+Left"] = "prev-word",
  149. ["Ctrl+N"] = "new-file",
  150. ["Ctrl+O"] = "open",
  151. ["Ctrl+P"] = "open-asset",
  152. ["Ctrl+Q"] = "quit",
  153. ["Ctrl+R"] = "hot-reload",
  154. ["Ctrl+Right"] = "next-word",
  155. ["Ctrl+S"] = "save-all",
  156. ["Ctrl+Slash"] = "toggle-comment",
  157. ["Ctrl+Space"] = "proposals",
  158. ["Ctrl+T"] = "scene-stop",
  159. ["Ctrl+U"] = "rebundle",
  160. ["Ctrl+V"] = "paste",
  161. ["Ctrl+W"] = "close",
  162. ["Ctrl+X"] = "cut",
  163. ["Ctrl+Z"] = "undo",
  164. ["Delete"] = "delete",
  165. ["Down"] = "down",
  166. ["E"] = "rotate-tool",
  167. ["End"] = "end-of-line",
  168. ["Enter"] = "enter",
  169. ["Esc"] = "escape",
  170. ["F"] = "frame-selection",
  171. ["F1"] = "documentation",
  172. ["F10"] = "step-over",
  173. ["F11"] = "step-into",
  174. ["F2"] = "rename",
  175. ["F5"] = "start-debugger",
  176. ["F5"] = "continue",
  177. ["F6"] = "toggle-pane-left",
  178. ["F7"] = "toggle-pane-bottom",
  179. ["F8"] = "toggle-pane-right",
  180. ["F9"] = "toggle-breakpoint",
  181. ["Home"] = "beginning-of-line-text",
  182. ["Left"] = "left",
  183. ["Page Down"] = "page-down",
  184. ["Page Up"] = "page-up",
  185. ["Period"] = "realign-camera",
  186. ["R"] = "scale-tool",
  187. ["Right"] = "right",
  188. ["Shift+A"] = "add-secondary",
  189. ["Shift+Ctrl+B"] = "rebuild",
  190. ["Shift+Ctrl+Delete"] = "delete-to-end-of-line",
  191. ["Shift+Ctrl+E"] = "show-last-hidden",
  192. ["Shift+Ctrl+End"] = "select-end-of-file",
  193. ["Shift+Ctrl+F"] = "search-in-files",
  194. ["Shift+Ctrl+G"] = "find-prev",
  195. ["Shift+Ctrl+H"] = "replace-next",
  196. ["Shift+Ctrl+Home"] = "select-beginning-of-file",
  197. ["Shift+Ctrl+I"] = "toggle-visibility-filters",
  198. ["Shift+Ctrl+L"] = "split-selection-into-lines",
  199. ["Shift+Ctrl+Left"] = "select-prev-word",
  200. ["Shift+Ctrl+R"] = "open-asset",
  201. ["Shift+Ctrl+Right"] = "select-next-word",
  202. ["Shift+Ctrl+W"] = "close-all",
  203. ["Shift+Ctrl+Z"] = "redo",
  204. ["Shift+Down"] = "down-major",
  205. ["Shift+Down"] = "select-down",
  206. ["Shift+E"] = "erase-tool",
  207. ["Shift+End"] = "select-end-of-line",
  208. ["Shift+F11"] = "step-out",
  209. ["Shift+F5"] = "stop-debugger",
  210. ["Shift+Home"] = "select-beginning-of-line-text",
  211. ["Shift+Left"] = "left-major",
  212. ["Shift+Left"] = "select-left",
  213. ["Shift+Page Down"] = "select-page-down",
  214. ["Shift+Page Up"] = "select-page-up",
  215. ["Shift+Right"] = "right-major",
  216. ["Shift+Right"] = "select-right",
  217. ["Shift+Tab"] = "backwards-tab-trigger",
  218. ["Shift+Up"] = "select-up",
  219. ["Shift+Up"] = "up-major",
  220. ["Space"] = "scene-play",
  221. ["Space"] = "show-palette",
  222. ["Tab"] = "tab",
  223. ["Up"] = "up",
  224. ["W"] = "move-tool",
  225. },
  226. linux = {
  227. ["A"] = "add",
  228. ["Alt+Down"] = "move-down",
  229. ["Alt+Up"] = "move-up",
  230. ["Backspace"] = "delete-backward",
  231. ["Ctrl+'+'"] = "zoom-in",
  232. ["Ctrl+'-'"] = "zoom-out",
  233. ["Ctrl+A"] = "select-all",
  234. ["Ctrl+B"] = "build",
  235. ["Ctrl+Backspace"] = "delete-prev-word",
  236. ["Ctrl+C"] = "copy",
  237. ["Ctrl+Comma"] = "preferences",
  238. ["Ctrl+D"] = "select-next-occurrence",
  239. ["Ctrl+Delete"] = "delete-next-word",
  240. ["Ctrl+E"] = "hide-selected",
  241. ["Ctrl+End"] = "end-of-file",
  242. ["Ctrl+F"] = "filter-form",
  243. ["Ctrl+F"] = "find-text",
  244. ["Ctrl+G"] = "find-next",
  245. ["Ctrl+H"] = "replace-text",
  246. ["Ctrl+H"] = "toggle-component-guides",
  247. ["Ctrl+Home"] = "beginning-of-file",
  248. ["Ctrl+I"] = "reindent",
  249. ["Ctrl+K"] = "delete-to-end-of-line",
  250. ["Ctrl+L"] = "goto-line",
  251. ["Ctrl+Left"] = "prev-word",
  252. ["Ctrl+N"] = "new-file",
  253. ["Ctrl+O"] = "open",
  254. ["Ctrl+P"] = "open-asset",
  255. ["Ctrl+Q"] = "quit",
  256. ["Ctrl+R"] = "hot-reload",
  257. ["Ctrl+Right"] = "next-word",
  258. ["Ctrl+S"] = "save-all",
  259. ["Ctrl+Slash"] = "toggle-comment",
  260. ["Ctrl+Space"] = "proposals",
  261. ["Ctrl+T"] = "scene-stop",
  262. ["Ctrl+U"] = "rebundle",
  263. ["Ctrl+V"] = "paste",
  264. ["Ctrl+W"] = "close",
  265. ["Ctrl+X"] = "cut",
  266. ["Ctrl+Z"] = "undo",
  267. ["Delete"] = "delete",
  268. ["Down"] = "down",
  269. ["E"] = "rotate-tool",
  270. ["End"] = "end-of-line",
  271. ["Enter"] = "enter",
  272. ["Esc"] = "escape",
  273. ["F"] = "frame-selection",
  274. ["F1"] = "documentation",
  275. ["F10"] = "step-over",
  276. ["F11"] = "step-into",
  277. ["F2"] = "rename",
  278. ["F5"] = "start-debugger",
  279. ["F5"] = "continue",
  280. ["F6"] = "toggle-pane-left",
  281. ["F7"] = "toggle-pane-bottom",
  282. ["F8"] = "toggle-pane-right",
  283. ["F9"] = "toggle-breakpoint",
  284. ["Home"] = "beginning-of-line-text",
  285. ["Left"] = "left",
  286. ["Page Down"] = "page-down",
  287. ["Page Up"] = "page-up",
  288. ["Period"] = "realign-camera",
  289. ["R"] = "scale-tool",
  290. ["Right"] = "right",
  291. ["Shift+A"] = "add-secondary",
  292. ["Shift+Ctrl+B"] = "rebuild",
  293. ["Shift+Ctrl+Delete"] = "delete-to-end-of-line",
  294. ["Shift+Ctrl+E"] = "show-last-hidden",
  295. ["Shift+Ctrl+End"] = "select-end-of-file",
  296. ["Shift+Ctrl+F"] = "search-in-files",
  297. ["Shift+Ctrl+G"] = "find-prev",
  298. ["Shift+Ctrl+H"] = "replace-next",
  299. ["Shift+Ctrl+Home"] = "select-beginning-of-file",
  300. ["Shift+Ctrl+I"] = "toggle-visibility-filters",
  301. ["Shift+Ctrl+L"] = "split-selection-into-lines",
  302. ["Shift+Ctrl+Left"] = "select-prev-word",
  303. ["Shift+Ctrl+R"] = "open-asset",
  304. ["Shift+Ctrl+Right"] = "select-next-word",
  305. ["Shift+Ctrl+W"] = "close-all",
  306. ["Shift+Ctrl+Z"] = "redo",
  307. ["Shift+Down"] = "down-major",
  308. ["Shift+Down"] = "select-down",
  309. ["Shift+E"] = "erase-tool",
  310. ["Shift+End"] = "select-end-of-line",
  311. ["Shift+F11"] = "step-out",
  312. ["Shift+F5"] = "stop-debugger",
  313. ["Shift+Home"] = "select-beginning-of-line-text",
  314. ["Shift+Left"] = "left-major",
  315. ["Shift+Left"] = "select-left",
  316. ["Shift+Page Down"] = "select-page-down",
  317. ["Shift+Page Up"] = "select-page-up",
  318. ["Shift+Right"] = "right-major",
  319. ["Shift+Right"] = "select-right",
  320. ["Shift+Tab"] = "backwards-tab-trigger",
  321. ["Shift+Up"] = "select-up",
  322. ["Shift+Up"] = "up-major",
  323. ["Space"] = "scene-play",
  324. ["Space"] = "show-palette",
  325. ["Tab"] = "tab",
  326. ["Up"] = "up",
  327. ["W"] = "move-tool",
  328. }
  329. }
  330. local function fix_binding(binding)
  331. if not binding then return "" end
  332. binding = binding:gsub("Meta", "Cmd")
  333. binding = "<kbd>" .. binding .. "</kbd>"
  334. binding = binding:gsub("+", "</kbd>+<kbd>")
  335. return binding
  336. end
  337. local commands = {}
  338. for os,keymap in pairs(keymaps) do
  339. for keybinding,command in pairs(keymap) do
  340. commands[command] = commands[command] or {}
  341. commands[command][os] = keybinding
  342. end
  343. end
  344. local sorted_commands = {}
  345. for command,bindings in pairs(commands) do
  346. bindings.command = command
  347. sorted_commands[#sorted_commands + 1] = bindings
  348. end
  349. table.sort(sorted_commands, function(a, b)
  350. return a.command < b.command
  351. end)
  352. print("| Command | Windows | macOS | Linux |")
  353. print("|---------|---------|-------|-------|")
  354. for _,bindings in ipairs(sorted_commands) do
  355. local command = bindings.command
  356. command = command:gsub("-", " ")
  357. command = command:sub(1,1):upper() .. command:sub(2)
  358. local win32 = fix_binding(bindings.win32)
  359. local darwin = fix_binding(bindings.darwin)
  360. local linux = fix_binding(bindings.linux)
  361. print(("| %s | %s | %s | %s |"):format(command, win32, darwin, linux))
  362. end