Skip to content

Instantly share code, notes, and snippets.

@Metaxal
Created July 13, 2020 11:42
Show Gist options
  • Save Metaxal/e13002ffb19e2d1fe4d98f7def8f8c0d to your computer and use it in GitHub Desktop.
Save Metaxal/e13002ffb19e2d1fe4d98f7def8f8c0d to your computer and use it in GitHub Desktop.
Reuse global keymap functions for a custom keymap
(define map-global-function
(let* ([km-global (keymap:get-global)]
[table (for/hash ([name (in-list (dict-values (send km-global get-map-function-table)))])
(values name #t))])
(λ (km key name)
(unless (dict-has-key? table name)
(error "Unknown function" name))
(send km add-function name
(λ (in ev)
(send km-global call-function name in ev #t)))
(send km map-function key name))))
(map-global-function my-keymap "c:backspace" "backward-kill-word")
@Metaxal
Copy link
Author

Metaxal commented Jul 13, 2020

List of available functions:

'("TeX compress"
  "back-to-prev-embedded-editor"
  "backward-character"
  "backward-kill-word"
  "backward-select"
  "backward-select-word"
  "backward-word"
  "beginning-of-file"
  "beginning-of-line"
  "capitalize-word"
  "center-in-unicode-ascii-art-box"
  "center-view-on-line"
  "collapse-newline"
  "collapse-space"
  "command-repeat-0"
  "command-repeat-1"
  "command-repeat-2"
  "command-repeat-3"
  "command-repeat-4"
  "command-repeat-5"
  "command-repeat-6"
  "command-repeat-7"
  "command-repeat-8"
  "command-repeat-9"
  "copy-clipboard"
  "copy-clipboard/disable-anchor"
  "cut-clipboard"
  "delete-key"
  "delete-next-character"
  "delete-previous-character"
  "delete-to-end-of-line"
  "down-into-embedded-editor"
  "downcase-word"
  "end-of-file"
  "end-of-line"
  "forward-character"
  "forward-select"
  "forward-select-word"
  "forward-to-next-embedded-editor"
  "forward-word"
  "goto-line"
  "highten-unicode-ascii-art-box"
  "insert Α"
  "insert Β"
  "insert Γ"
  "insert Δ"
  "insert Ε"
  "insert Ζ"
  "insert Η"
  "insert Θ"
  "insert Ι"
  "insert Κ"
  "insert Λ"
  "insert Μ"
  "insert Ν"
  "insert Ξ"
  "insert Ο"
  "insert Π"
  "insert Ρ"
  "insert Σ"
  "insert Τ"
  "insert Υ"
  "insert Φ"
  "insert Χ"
  "insert Ψ"
  "insert Ω"
  "insert α"
  "insert β"
  "insert γ"
  "insert δ"
  "insert ε"
  "insert ζ"
  "insert η"
  "insert θ"
  "insert ι"
  "insert κ"
  "insert λ"
  "insert μ"
  "insert ν"
  "insert ξ"
  "insert ο"
  "insert π"
  "insert ρ"
  "insert ς"
  "insert σ"
  "insert τ"
  "insert υ"
  "insert φ"
  "insert χ"
  "insert ψ"
  "insert ω"
  "keyboard-macro-end-record"
  "keyboard-macro-run-saved"
  "keyboard-macro-start-record"
  "kill-word"
  "make-read-only"
  "mouse-popup-menu"
  "newline"
  "next-line"
  "next-page"
  "normalize-unicode-ascii-art-box"
  "open-line"
  "paste-click-region"
  "paste-clipboard"
  "paste-next"
  "previous-line"
  "previous-page"
  "redo"
  "ring-bell"
  "select-click-line"
  "select-click-word"
  "select-down"
  "select-page-down"
  "select-page-up"
  "select-to-beginning-of-file"
  "select-to-beginning-of-line"
  "select-to-end-of-file"
  "select-to-end-of-line"
  "select-up"
  "shift-focus"
  "shift-focus-backwards"
  "toggle-anchor"
  "toggle-overwrite (when enabled in prefs)"
  "toggle-unicode-ascii-art-enlarge-mode"
  "transpose-chars"
  "transpose-words"
  "undo"
  "up-out-of-embedded-editor"
  "upcase-word"
  "widen-unicode-ascii-art-box")

Noteworthy: keyboard-macro*, TeX-compress, *-ascii-art-box

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment