Sources/OrgCore/Keymap/Presets.swift

771145d436cf29bfc925517d8abc5a410c9a2f7b
orgstar/Sources/OrgCore/Keymap/Presets.swift history · blame · raw

906 lines · 25236 bytes

  1/// The keymaps the app ships. The user's `keymap.toml` is layered on top of the chosen one.
  2public enum KeymapPreset: String, Sendable, CaseIterable {
  3    case emacs, mac, doom
  4
  5    public var title: String {
  6        switch self {
  7        case .emacs: "Emacs"
  8        case .mac: "Mac"
  9        case .doom: "Doom (Vim keys)"
 10        }
 11    }
 12
 13    /// Whether the preset edits modally.
 14    public var isModal: Bool { self == .doom }
 15
 16    public var keymap: Keymap {
 17        var problems: [String] = []
 18        let map = try! Keymap(toml: toml, problems: &problems)
 19        precondition(problems.isEmpty, "preset \(rawValue): \(problems)")
 20        return map
 21    }
 22
 23    public var toml: String {
 24        switch self {
 25        case .emacs: Self.common + Self.emacsBindings
 26        case .mac: Self.common + Self.macBindings
 27        case .doom: Self.doomToml
 28        }
 29    }
 30
 31    /// Doom: the Emacs preset's org bindings in every evil state (as org-mode-map's are), with
 32    /// evil-org's `M-h/j/k/l` forms, then Doom's leader, localleader and evil-org keys.
 33    static var doomToml: String {
 34        var problems: [String] = []
 35        let emacs = try! Keymap(toml: common + emacsBindings, problems: &problems)
 36        let translations: [String: String] = ["<left>": "h", "<right>": "l", "<up>": "k", "<down>": "j"]
 37        var out = ""
 38        func bind(_ keys: String, _ command: String, when: String?, mode: String) {
 39            out += "[[bind]]\nkeys = \"\(keys.replacingOccurrences(of: "\\", with: "\\\\"))\"\ncommand = \"\(command)\"\n"
 40            if let when { out += "when = \"\(when)\"\n" }
 41            out += "mode = \"\(mode)\"\n"
 42        }
 43        for binding in emacs.bindings {
 44            let first = binding.keys[0]
 45            let keys = KeySequence.format(binding.keys)
 46            let orgKey = first.key == "c" && first.modifiers == [.control] || first.key == "x" && first.modifiers == [.control]
 47                || (first.modifiers.contains(.meta) && ["<left>", "<right>", "<up>", "<down>", "RET"].contains(first.key))
 48                || (first.modifiers.contains(.shift) && ["<left>", "<right>", "<up>", "<down>"].contains(first.key))
 49                || (first.modifiers == [.control] && first.key == "RET")
 50                || keys == "M-x"
 51            guard orgKey else { continue }
 52            for mode in ["normal", "insert", "visual"] { bind(keys, binding.command, when: binding.when, mode: mode) }
 53            // evil-org: M-h/j/k/l and M-H/J/K/L in normal, visual and insert.
 54            if binding.keys.count == 1, first.modifiers.contains(.meta), let letter = translations[first.key] {
 55                let shifted = first.modifiers.contains(.shift)
 56                let key = "M-" + (shifted ? letter.uppercased() : letter)
 57                for mode in ["normal", "insert", "visual"] { bind(key, binding.command, when: binding.when, mode: mode) }
 58            }
 59            // Doom: C-S-h/j/k/l are org-shift* in normal and insert.
 60            if binding.keys.count == 1, first.modifiers == [.shift], let letter = translations[first.key] {
 61                for mode in ["normal", "insert"] { bind("C-" + letter.uppercased(), binding.command, when: binding.when, mode: mode) }
 62            }
 63            // evil-org insert state: C-t demotes, C-d promotes.
 64            if binding.keys.count == 1, first.modifiers == [.meta], first.key == "<right>" || first.key == "<left>" {
 65                bind(first.key == "<right>" ? "C-t" : "C-d", binding.command, when: binding.when, mode: "insert")
 66            }
 67        }
 68        return out + doomBindings
 69    }
 70
 71    static let doomBindings = """
 72        # Leader
 73        [[bind]]
 74        keys = "SPC SPC"
 75        command = "app.quick-open"
 76        mode = "normal"
 77        [[bind]]
 78        keys = "SPC q q"
 79        command = "app.quit"
 80        mode = "normal"
 81        [[bind]]
 82        keys = "SPC ."
 83        command = "app.quick-open"
 84        mode = "normal"
 85        [[bind]]
 86        keys = "SPC f f"
 87        command = "app.quick-open"
 88        mode = "normal"
 89        [[bind]]
 90        keys = "SPC b b"
 91        command = "app.quick-open"
 92        mode = "normal"
 93        [[bind]]
 94        keys = "SPC f s"
 95        command = "app.save"
 96        mode = "normal"
 97        [[bind]]
 98        keys = "SPC s s"
 99        command = "edit.find"
100        mode = "normal"
101        [[bind]]
102        keys = "SPC /"
103        command = "app.search"
104        mode = "normal"
105        [[bind]]
106        keys = "SPC s p"
107        command = "app.search"
108        mode = "normal"
109        [[bind]]
110        keys = "SPC :"
111        command = "app.palette"
112        mode = "normal"
113        [[bind]]
114        keys = "SPC o a"
115        command = "app.agenda"
116        mode = "normal"
117        [[bind]]
118        keys = "SPC X"
119        command = "app.capture"
120        mode = "normal"
121        [[bind]]
122        keys = "SPC z t"
123        command = "app.clock.report"
124        mode = "normal"
125        [[bind]]
126        keys = "SPC h r r"
127        command = "app.reload-keymap"
128        mode = "normal"
129
130        # Localleader (SPC m)
131        [[bind]]
132        keys = "SPC m t"
133        command = "org.todo.cycle"
134        mode = "normal"
135        [[bind]]
136        keys = "SPC m q"
137        command = "org.tags.set"
138        mode = "normal"
139        [[bind]]
140        keys = "SPC m x"
141        command = "org.checkbox.toggle"
142        mode = "normal"
143        [[bind]]
144        keys = "SPC m A"
145        command = "app.archive"
146        mode = "normal"
147        [[bind]]
148        keys = "SPC m e h h"
149        command = "app.export.html"
150        mode = "normal"
151        [[bind]]
152        keys = "SPC m e h o"
153        command = "app.export.html-open"
154        mode = "normal"
155        [[bind]]
156        keys = "SPC m e m m"
157        command = "app.export.markdown"
158        mode = "normal"
159        [[bind]]
160        keys = "SPC m e l p"
161        command = "app.export.pdf"
162        mode = "normal"
163        [[bind]]
164        keys = "SPC m d d"
165        command = "org.deadline"
166        mode = "normal"
167        [[bind]]
168        keys = "SPC m d s"
169        command = "org.schedule"
170        mode = "normal"
171        [[bind]]
172        keys = "SPC m d t"
173        command = "org.timestamp.active"
174        mode = "normal"
175        [[bind]]
176        keys = "SPC m d T"
177        command = "org.timestamp.inactive"
178        mode = "normal"
179        [[bind]]
180        keys = "SPC m r r"
181        command = "app.refile"
182        mode = "normal"
183        [[bind]]
184        keys = "SPC m s r"
185        command = "app.refile"
186        mode = "normal"
187        [[bind]]
188        keys = "SPC m s A"
189        command = "app.archive"
190        mode = "normal"
191        [[bind]]
192        keys = "SPC m s h"
193        command = "org.subtree.promote"
194        mode = "normal"
195        [[bind]]
196        keys = "SPC m s l"
197        command = "org.subtree.demote"
198        mode = "normal"
199        [[bind]]
200        keys = "SPC m s j"
201        command = "org.subtree.down"
202        mode = "normal"
203        [[bind]]
204        keys = "SPC m s k"
205        command = "org.subtree.up"
206        mode = "normal"
207        [[bind]]
208        keys = "SPC m c i"
209        command = "app.clock.in"
210        mode = "normal"
211        [[bind]]
212        keys = "SPC m c o"
213        command = "app.clock.out"
214        mode = "normal"
215        [[bind]]
216        keys = "SPC m c c"
217        command = "app.clock.cancel"
218        mode = "normal"
219        [[bind]]
220        keys = "SPC m c g"
221        command = "app.clock.goto"
222        mode = "normal"
223        [[bind]]
224        keys = "SPC m c R"
225        command = "app.clock.report"
226        mode = "normal"
227        [[bind]]
228        keys = "SPC m p u"
229        command = "org.priority.up"
230        mode = "normal"
231        [[bind]]
232        keys = "SPC m p d"
233        command = "org.priority.down"
234        mode = "normal"
235        [[bind]]
236        keys = "SPC m b -"
237        command = "org.table.insert-hline"
238        mode = "normal"
239        [[bind]]
240        keys = "SPC m b a"
241        command = "org.table.align"
242        mode = "normal"
243        [[bind]]
244        keys = "SPC m b r"
245        command = "org.table.recalc-all"
246        mode = "normal"
247        [[bind]]
248        keys = "SPC m b d c"
249        command = "org.table.delete-column"
250        mode = "normal"
251        [[bind]]
252        keys = "SPC m b d r"
253        command = "org.table.kill-row"
254        mode = "normal"
255        [[bind]]
256        keys = "SPC m b i c"
257        command = "org.table.insert-column"
258        mode = "normal"
259        [[bind]]
260        keys = "SPC m b i r"
261        command = "org.table.insert-row"
262        mode = "normal"
263        [[bind]]
264        keys = "SPC m b i h"
265        command = "org.table.insert-hline"
266        mode = "normal"
267
268        # evil-org and Doom's org keys
269        [[bind]]
270        keys = "TAB"
271        command = "org.cycle"
272        mode = "normal"
273        [[bind]]
274        keys = "S-TAB"
275        command = "org.cycle-global"
276        mode = "normal"
277        [[bind]]
278        keys = "RET"
279        command = "org.dwim"
280        mode = "normal"
281        [[bind]]
282        keys = "z a"
283        command = "org.cycle"
284        mode = "normal"
285        [[bind]]
286        keys = "z c"
287        command = "org.cycle"
288        mode = "normal"
289        [[bind]]
290        keys = "z o"
291        command = "org.cycle"
292        mode = "normal"
293        [[bind]]
294        keys = "z A"
295        command = "org.cycle-global"
296        mode = "normal"
297        [[bind]]
298        keys = "g h"
299        command = "org.heading.up"
300        mode = "normal"
301        [[bind]]
302        keys = "g j"
303        command = "org.heading.forward-same-level"
304        mode = "normal"
305        [[bind]]
306        keys = "g k"
307        command = "org.heading.backward-same-level"
308        mode = "normal"
309        [[bind]]
310        keys = "] h"
311        command = "org.heading.forward-same-level"
312        mode = "normal"
313        [[bind]]
314        keys = "[ h"
315        command = "org.heading.backward-same-level"
316        mode = "normal"
317        [[bind]]
318        keys = "RET"
319        command = "org.table.next-row"
320        when = "table"
321        mode = "insert"
322        [[bind]]
323        keys = "TAB"
324        command = "org.cycle"
325        mode = "visual"
326        [[bind]]
327        keys = "S-TAB"
328        command = "org.cycle-global"
329        mode = "visual"
330
331        # Insert state: org-cycle and org-shifttab with Doom's +org-indent-maybe-h, which
332        # demotes or promotes a heading and indents or outdents an item tree.
333        [[bind]]
334        keys = "S-TAB"
335        command = "org.cycle-global"
336        mode = "insert"
337        [[bind]]
338        keys = "TAB"
339        command = "org.table.next-field"
340        when = "table"
341        mode = "insert"
342        [[bind]]
343        keys = "S-TAB"
344        command = "org.table.previous-field"
345        when = "table"
346        mode = "insert"
347        [[bind]]
348        keys = "TAB"
349        command = "org.item.indent-tree"
350        when = "item"
351        mode = "insert"
352        [[bind]]
353        keys = "S-TAB"
354        command = "org.item.outdent-tree"
355        when = "item"
356        mode = "insert"
357        [[bind]]
358        keys = "TAB"
359        command = "org.heading.demote"
360        when = "heading"
361        mode = "insert"
362        [[bind]]
363        keys = "S-TAB"
364        command = "org.heading.promote"
365        when = "heading"
366        mode = "insert"
367
368        """
369
370
371    static let common = """
372        [[bind]]
373        keys = "TAB"
374        command = "org.cycle"
375        when = "heading"
376
377        [[bind]]
378        keys = "S-TAB"
379        command = "org.cycle-global"
380        [[bind]]
381        keys = "TAB"
382        command = "org.table.next-field"
383        when = "table"
384        [[bind]]
385        keys = "S-TAB"
386        command = "org.table.previous-field"
387        when = "table"
388        [[bind]]
389        keys = "RET"
390        command = "org.table.next-row"
391        when = "table"
392
393        """
394
395    static let emacsBindings = """
396        # Movement and editing. With a mark set (C-SPC), movement extends the region.
397        [[bind]]
398        keys = "C-f"
399        command = "edit.forward-char"
400        [[bind]]
401        keys = "C-b"
402        command = "edit.backward-char"
403        [[bind]]
404        keys = "C-n"
405        command = "edit.next-line"
406        [[bind]]
407        keys = "C-p"
408        command = "edit.previous-line"
409        [[bind]]
410        keys = "C-a"
411        command = "edit.beginning-of-line"
412        [[bind]]
413        keys = "C-e"
414        command = "edit.end-of-line"
415        [[bind]]
416        keys = "M-f"
417        command = "edit.forward-word"
418        [[bind]]
419        keys = "M-b"
420        command = "edit.backward-word"
421        [[bind]]
422        keys = "M-<"
423        command = "edit.beginning-of-buffer"
424        [[bind]]
425        keys = "M->"
426        command = "edit.end-of-buffer"
427        [[bind]]
428        keys = "C-v"
429        command = "edit.scroll-up"
430        [[bind]]
431        keys = "M-v"
432        command = "edit.scroll-down"
433        [[bind]]
434        keys = "C-l"
435        command = "edit.recenter"
436        [[bind]]
437        keys = "C-d"
438        command = "edit.delete-char"
439        [[bind]]
440        keys = "M-d"
441        command = "edit.kill-word"
442        [[bind]]
443        keys = "M-DEL"
444        command = "edit.backward-kill-word"
445        [[bind]]
446        keys = "C-k"
447        command = "edit.kill-line"
448        [[bind]]
449        keys = "C-y"
450        command = "edit.yank"
451        [[bind]]
452        keys = "C-SPC"
453        command = "edit.set-mark"
454        [[bind]]
455        keys = "C-x h"
456        command = "edit.select-all"
457        [[bind]]
458        keys = "C-w"
459        command = "edit.kill-region"
460        [[bind]]
461        keys = "M-w"
462        command = "edit.copy-region"
463        [[bind]]
464        keys = "C-/"
465        command = "edit.undo"
466        [[bind]]
467        keys = "C-_"
468        command = "edit.undo"
469        [[bind]]
470        keys = "C-x u"
471        command = "edit.undo"
472        [[bind]]
473        keys = "C-g"
474        command = "edit.keyboard-quit"
475        [[bind]]
476        keys = "C-t"
477        command = "edit.transpose-chars"
478        [[bind]]
479        keys = "C-s"
480        command = "edit.find"
481        [[bind]]
482        keys = "C-r"
483        command = "edit.find"
484        [[bind]]
485        keys = "M-%"
486        command = "edit.replace"
487
488        # Files and commands
489        [[bind]]
490        keys = "C-x C-s"
491        command = "app.save"
492        [[bind]]
493        keys = "C-x C-f"
494        command = "app.quick-open"
495        [[bind]]
496        keys = "C-x b"
497        command = "app.quick-open"
498        [[bind]]
499        keys = "M-x"
500        command = "app.palette"
501        [[bind]]
502        keys = "C-c a"
503        command = "app.agenda"
504        [[bind]]
505        keys = "C-c c"
506        command = "app.capture"
507        [[bind]]
508        keys = "C-c C-x C-i"
509        command = "app.clock.in"
510        [[bind]]
511        keys = "C-c C-x C-o"
512        command = "app.clock.out"
513        [[bind]]
514        keys = "C-c C-x C-q"
515        command = "app.clock.cancel"
516        [[bind]]
517        keys = "C-c C-x C-j"
518        command = "app.clock.goto"
519        [[bind]]
520        keys = "C-c C-e h h"
521        command = "app.export.html"
522        [[bind]]
523        keys = "C-c C-e h o"
524        command = "app.export.html-open"
525        [[bind]]
526        keys = "C-c C-e m m"
527        command = "app.export.markdown"
528        [[bind]]
529        keys = "C-c C-e l p"
530        command = "app.export.pdf"
531        [[bind]]
532        keys = "C-c C-e l l"
533        command = "app.export.latex"
534        [[bind]]
535        keys = "C-c C-e o o"
536        command = "app.export.odt"
537        [[bind]]
538        keys = "C-c C-e t u"
539        command = "app.export.text"
540
541        # Org
542        [[bind]]
543        keys = "C-c C-t"
544        command = "org.todo.cycle"
545        [[bind]]
546        keys = "S-<right>"
547        command = "org.todo.cycle"
548        when = "heading"
549        [[bind]]
550        keys = "S-<up>"
551        command = "org.priority.up"
552        when = "heading"
553        [[bind]]
554        keys = "S-<down>"
555        command = "org.priority.down"
556        when = "heading"
557        [[bind]]
558        keys = "M-<left>"
559        command = "org.heading.promote"
560        when = "heading"
561        [[bind]]
562        keys = "M-<right>"
563        command = "org.heading.demote"
564        when = "heading"
565        [[bind]]
566        keys = "M-S-<left>"
567        command = "org.subtree.promote"
568        when = "heading"
569        [[bind]]
570        keys = "M-S-<right>"
571        command = "org.subtree.demote"
572        when = "heading"
573        [[bind]]
574        keys = "M-<up>"
575        command = "org.subtree.up"
576        when = "heading"
577        [[bind]]
578        keys = "M-<down>"
579        command = "org.subtree.down"
580        when = "heading"
581        [[bind]]
582        keys = "M-RET"
583        command = "org.heading.insert"
584        [[bind]]
585        keys = "C-RET"
586        command = "org.heading.insert-after-subtree"
587        [[bind]]
588        keys = "M-S-RET"
589        command = "org.heading.insert-todo"
590        [[bind]]
591        keys = "C-c C-n"
592        command = "org.heading.next"
593        [[bind]]
594        keys = "C-c C-p"
595        command = "org.heading.previous"
596        [[bind]]
597        keys = "C-c C-f"
598        command = "org.heading.forward-same-level"
599        [[bind]]
600        keys = "C-c C-b"
601        command = "org.heading.backward-same-level"
602        [[bind]]
603        keys = "C-c C-u"
604        command = "org.heading.up"
605        [[bind]]
606        keys = "C-c C-q"
607        command = "org.tags.set"
608        [[bind]]
609        keys = "M-RET"
610        command = "org.item.insert"
611        when = "item"
612        [[bind]]
613        keys = "M-S-RET"
614        command = "org.item.insert-checkbox"
615        when = "item"
616        [[bind]]
617        keys = "M-<left>"
618        command = "org.item.outdent"
619        when = "item"
620        [[bind]]
621        keys = "M-<right>"
622        command = "org.item.indent"
623        when = "item"
624        [[bind]]
625        keys = "M-S-<left>"
626        command = "org.item.outdent-tree"
627        when = "item"
628        [[bind]]
629        keys = "M-S-<right>"
630        command = "org.item.indent-tree"
631        when = "item"
632        [[bind]]
633        keys = "M-<up>"
634        command = "org.item.up"
635        when = "item"
636        [[bind]]
637        keys = "M-<down>"
638        command = "org.item.down"
639        when = "item"
640        [[bind]]
641        keys = "C-c C-c"
642        command = "org.checkbox.toggle"
643        when = "item"
644        [[bind]]
645        keys = "C-c C-x C-b"
646        command = "org.checkbox.toggle"
647        [[bind]]
648        keys = "C-c C-w"
649        command = "app.refile"
650        [[bind]]
651        keys = "C-c C-x C-s"
652        command = "app.archive"
653        [[bind]]
654        keys = "C-c $"
655        command = "app.archive"
656        [[bind]]
657        keys = "C-c ."
658        command = "org.timestamp.active"
659        [[bind]]
660        keys = "C-c !"
661        command = "org.timestamp.inactive"
662        [[bind]]
663        keys = "C-c C-s"
664        command = "org.schedule"
665        [[bind]]
666        keys = "C-c C-d"
667        command = "org.deadline"
668        [[bind]]
669        keys = "M-q"
670        command = "org.fill-paragraph"
671        [[bind]]
672        keys = "C-c C-c"
673        command = "org.table.align"
674        when = "table"
675        [[bind]]
676        keys = "C-c C-c"
677        command = "org.table.recalc-all"
678        when = "tblfm"
679        [[bind]]
680        keys = "C-c *"
681        command = "org.table.recalc"
682        when = "table"
683        [[bind]]
684        keys = "C-c C-c"
685        command = "org.babel.execute"
686        when = "src"
687        [[bind]]
688        keys = "M-<up>"
689        command = "org.table.row-up"
690        when = "table"
691        [[bind]]
692        keys = "M-<down>"
693        command = "org.table.row-down"
694        when = "table"
695        [[bind]]
696        keys = "M-<left>"
697        command = "org.table.column-left"
698        when = "table"
699        [[bind]]
700        keys = "M-<right>"
701        command = "org.table.column-right"
702        when = "table"
703        [[bind]]
704        keys = "M-S-<right>"
705        command = "org.table.insert-column"
706        when = "table"
707        [[bind]]
708        keys = "M-S-<left>"
709        command = "org.table.delete-column"
710        when = "table"
711        [[bind]]
712        keys = "M-S-<up>"
713        command = "org.table.kill-row"
714        when = "table"
715        [[bind]]
716        keys = "M-S-<down>"
717        command = "org.table.insert-row"
718        when = "table"
719        [[bind]]
720        keys = "C-c -"
721        command = "org.table.insert-hline"
722        when = "table"
723        [[bind]]
724        keys = "C-c |"
725        command = "org.table.create"
726        [[bind]]
727        keys = "S-<up>"
728        command = "org.timestamp.up"
729        when = "timestamp"
730        [[bind]]
731        keys = "S-<down>"
732        command = "org.timestamp.down"
733        when = "timestamp"
734        [[bind]]
735        keys = "S-<right>"
736        command = "org.timestamp.day-later"
737        when = "timestamp"
738        [[bind]]
739        keys = "S-<left>"
740        command = "org.timestamp.day-earlier"
741        when = "timestamp"
742
743        """
744
745    /// Standard Mac text keys stay as they are; org commands use Control-Command chords, which
746    /// macOS text editing leaves free.
747    static let macBindings = """
748        [[bind]]
749        keys = "C-s-t"
750        command = "org.todo.cycle"
751        [[bind]]
752        keys = "C-s-<up>"
753        command = "org.priority.up"
754        [[bind]]
755        keys = "C-s-<down>"
756        command = "org.priority.down"
757        [[bind]]
758        keys = "C-s-<left>"
759        command = "org.heading.promote"
760        [[bind]]
761        keys = "C-s-<right>"
762        command = "org.heading.demote"
763        [[bind]]
764        keys = "C-M-s-<left>"
765        command = "org.subtree.promote"
766        [[bind]]
767        keys = "C-M-s-<right>"
768        command = "org.subtree.demote"
769        [[bind]]
770        keys = "C-M-s-<up>"
771        command = "org.subtree.up"
772        [[bind]]
773        keys = "C-M-s-<down>"
774        command = "org.subtree.down"
775        [[bind]]
776        keys = "s-RET"
777        command = "org.heading.insert"
778        [[bind]]
779        keys = "C-s-RET"
780        command = "org.heading.insert-after-subtree"
781        [[bind]]
782        keys = "s-S-RET"
783        command = "org.heading.insert-todo"
784        [[bind]]
785        keys = "M-s-<down>"
786        command = "org.heading.next"
787        [[bind]]
788        keys = "M-s-<up>"
789        command = "org.heading.previous"
790        [[bind]]
791        keys = "C-s-q"
792        command = "org.tags.set"
793        [[bind]]
794        keys = "s-RET"
795        command = "org.item.insert"
796        when = "item"
797        [[bind]]
798        keys = "s-S-RET"
799        command = "org.item.insert-checkbox"
800        when = "item"
801        [[bind]]
802        keys = "C-s-<left>"
803        command = "org.item.outdent"
804        when = "item"
805        [[bind]]
806        keys = "C-s-<right>"
807        command = "org.item.indent"
808        when = "item"
809        [[bind]]
810        keys = "C-M-s-<left>"
811        command = "org.item.outdent-tree"
812        when = "item"
813        [[bind]]
814        keys = "C-M-s-<right>"
815        command = "org.item.indent-tree"
816        when = "item"
817        [[bind]]
818        keys = "C-M-s-<up>"
819        command = "org.item.up"
820        when = "item"
821        [[bind]]
822        keys = "C-M-s-<down>"
823        command = "org.item.down"
824        when = "item"
825        [[bind]]
826        keys = "C-s-c"
827        command = "org.checkbox.toggle"
828        [[bind]]
829        keys = "C-s-w"
830        command = "app.refile"
831        [[bind]]
832        keys = "C-s-a"
833        command = "app.archive"
834        [[bind]]
835        keys = "C-s-."
836        command = "org.timestamp.active"
837        [[bind]]
838        keys = "C-M-s-."
839        command = "org.timestamp.inactive"
840        [[bind]]
841        keys = "C-s-s"
842        command = "org.schedule"
843        [[bind]]
844        keys = "C-s-d"
845        command = "org.deadline"
846        [[bind]]
847        keys = "C-s-p"
848        command = "org.fill-paragraph"
849        [[bind]]
850        keys = "C-s-<up>"
851        command = "org.table.row-up"
852        when = "table"
853        [[bind]]
854        keys = "C-s-<down>"
855        command = "org.table.row-down"
856        when = "table"
857        [[bind]]
858        keys = "C-s-<left>"
859        command = "org.table.column-left"
860        when = "table"
861        [[bind]]
862        keys = "C-s-<right>"
863        command = "org.table.column-right"
864        when = "table"
865        [[bind]]
866        keys = "C-M-s-<right>"
867        command = "org.table.insert-column"
868        when = "table"
869        [[bind]]
870        keys = "C-M-s-<left>"
871        command = "org.table.delete-column"
872        when = "table"
873        [[bind]]
874        keys = "C-M-s-<up>"
875        command = "org.table.kill-row"
876        when = "table"
877        [[bind]]
878        keys = "C-M-s-<down>"
879        command = "org.table.insert-row"
880        when = "table"
881        [[bind]]
882        keys = "C-s--"
883        command = "org.table.insert-hline"
884        when = "table"
885        [[bind]]
886        keys = "C-s-\\\\"
887        command = "org.table.create"
888        [[bind]]
889        keys = "C-s-<up>"
890        command = "org.timestamp.up"
891        when = "timestamp"
892        [[bind]]
893        keys = "C-s-<down>"
894        command = "org.timestamp.down"
895        when = "timestamp"
896        [[bind]]
897        keys = "C-s-<right>"
898        command = "org.timestamp.day-later"
899        when = "timestamp"
900        [[bind]]
901        keys = "C-s-<left>"
902        command = "org.timestamp.day-earlier"
903        when = "timestamp"
904
905        """
906}