{"id":13894740,"url":"https://github.com/justbur/emacs-bind-map","last_synced_at":"2025-07-05T13:32:52.814Z","repository":{"id":45105453,"uuid":"46228235","full_name":"justbur/emacs-bind-map","owner":"justbur","description":"Bind personal keymaps in multiple locations","archived":false,"fork":false,"pushed_at":"2025-03-08T12:10:29.000Z","size":85,"stargazers_count":62,"open_issues_count":1,"forks_count":9,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-13T10:57:59.140Z","etag":null,"topics":["emacs","emacs-keybindings","emacs-packages"],"latest_commit_sha":null,"homepage":null,"language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/justbur.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-15T17:34:50.000Z","updated_at":"2025-03-08T12:10:33.000Z","dependencies_parsed_at":"2025-03-27T02:11:10.880Z","dependency_job_id":"77eb90fc-68e9-4ae5-b7a4-185fec7e7299","html_url":"https://github.com/justbur/emacs-bind-map","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/justbur/emacs-bind-map","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justbur%2Femacs-bind-map","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justbur%2Femacs-bind-map/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justbur%2Femacs-bind-map/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justbur%2Femacs-bind-map/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/justbur","download_url":"https://codeload.github.com/justbur/emacs-bind-map/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justbur%2Femacs-bind-map/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263749826,"owners_count":23505458,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["emacs","emacs-keybindings","emacs-packages"],"created_at":"2024-08-06T18:01:44.142Z","updated_at":"2025-07-05T13:32:52.787Z","avatar_url":"https://github.com/justbur.png","language":"Emacs Lisp","funding_links":[],"categories":["Emacs Lisp"],"sub_categories":[],"readme":"[[https://travis-ci.org/justbur/emacs-bind-map][file:https://travis-ci.org/justbur/emacs-bind-map.svg?branch=master]] [[http://melpa.org/#/bind-map][file:http://melpa.org/packages/bind-map-badge.svg]]\n\n* bind-map\nbind-map is an Emacs package providing the macro =bind-map= which can be used to\nmake a keymap available across different \"leader keys\" including ones tied to\nevil states. It is essentially a generalization of the idea of a leader key as\nused in vim or the Emacs [[https://github.com/cofi/evil-leader][evil-leader]] package, and allows for an arbitrary number\nof \"leader keys\". This is probably best explained with an example.\n\n#+BEGIN_SRC emacs-lisp\n(bind-map my-base-leader-map\n  :keys (\"M-m\")\n  :evil-keys (\"SPC\")\n  :evil-states (normal motion visual))\n(bind-map my-elisp-map\n  :keys (\"M-m m\" \"M-RET\")\n  :evil-keys (\"SPC m\" \",\")\n  :major-modes (emacs-lisp-mode\n                lisp-interaction-mode))\n#+END_SRC\n\nThis will make =my-base-leader-map= (automatically creating the map if it's not\ndefined yet) available under the prefixes (or leaders) =M-m= and =SPC=, where\nthe latter is only bound in evil's normal, motion or visual states. The second\ndeclaration makes =my-elisp-map= available under the specified keys when one of\nthe specified major modes is active. In the second case, the evil states used\nare also normal motion and visual because this is the default as specified in\n=bind-map-default-evil-states=. It is possible to make the bindings conditional\non minor modes being loaded, or a mix of major and minor modes. Since the\nsymbols of the modes are used, it is not necessary to ensure that any of the\nmode's packages are loaded prior to this declaration. See the docstring of\n=bind-map= for more options.\n\nThis package will only make use of evil if one of the evil related keywords is\nspecified. This declaration, for example, makes no use of the evil package.\n\n#+BEGIN_SRC emacs-lisp\n(bind-map my-elisp-map\n  :keys (\"M-m m\" \"M-RET\")\n  :major-modes (emacs-lisp-mode\n                lisp-interaction-mode))\n#+END_SRC\n\nThe idea behind this package is that you want to organize your personal bindings\nin a series of keymaps separate from built-in mode maps. You can simply add keys\nusing the built-in =define-key= to =my-elisp-map= for example, and a declaration\nlike the one above will take care of ensuring that these bindings are available\nin the correct places.\n\n** Binding keys in the maps\nYou may use the built-in =define-key= which will function as intended.\n=bind-key= (part of [[https://github.com/jwiegley/use-package][use-package]]) is another option. For those who want a\ndifferent interface, you may either use the =:bindings= keyword in the\n=bind-map= macro or the two provided functions =bind-map-set-keys= and\n=bind-map-set-key-defaults=, which both just use =define-key= internally, but\nallow for multiple bindings without much syntax.\n\n#+BEGIN_SRC emacs-lisp\n  (bind-map my-base-leader-map\n    :keys (\"M-m\")\n    :evil-keys (\"SPC\")\n    :evil-states (normal motion visual)\n    :bindings (\"c\" 'compile\n               \"C\" 'check))\n\n  (bind-map-set-keys my-base-leader-map\n    \"c\" 'compile\n    \"C\" 'check\n    ;; ...\n    )\n    ;; is the same as\n    ;; (define-key my-base-leader-map (kbd \"c\") 'compile)\n    ;; (define-key my-base-leader-map (kbd \"C\") 'check)\n    ;; ...\n\n  (bind-map-set-key-defaults my-base-leader-map\n    \"c\" 'compile\n    ;; ...\n    )\n    ;; is the same as\n    ;; (unless (lookup-key my-base-leader-map (kbd \"c\"))\n    ;;   (define-key my-base-leader-map (kbd \"c\") 'compile))\n    ;; ...\n#+END_SRC\n\nThe second function only adds the bindings if there is no existing binding for\nthat key. It is probably only useful for shared configurations, where you want\nto provide a default binding but don't want that binding to overwrite one made\nby the user. Note the keys in both functions are strings that are passed to\n=kbd= before binding them.\n\n** Avoiding repetition\nIf you use multiple =bind-map= declarations you might find yourself repeating\nproperties like =:evil-keys= and =:evil-states=. You may use\n=bind-map-for-mode-inherit= to automatically pull these properties from a parent\nmap as the following example illustrates. See the docstring for more\ninformation.\n\n#+BEGIN_SRC emacs-lisp\n(bind-map my-leader-map\n  :keys (\"M-m\")\n  :evil-keys (\"SPC\")\n  :evil-states (normal motion visual))\n\n(bind-map-for-mode-inherit my-markdown-map my-leader-map\n  :major-modes (markdown-mode))\n#+END_SRC\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustbur%2Femacs-bind-map","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustbur%2Femacs-bind-map","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustbur%2Femacs-bind-map/lists"}