Sources/OrgCore/Keymap/Presets.swift

7cc38fb0066433ded701b9b02dcebb078e34a7dc
orgstar/Sources/OrgCore/Keymap/Presets.swift history · blame · raw

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