This package provides functions to protect certain key-bindings in certain keymaps. It mainly does this in two ways when ironkey-mode is enabled:
-
For each
(key . map)
pair inironkey-iron-alist
, if there's an attempt to bindkey
inmap
to a different value, ironkey will not perform such binding. Whenmap
is nil, ironkey protectskey
inglobal-map
. -
To avoid clashing among minor mode maps, the local map and the global map, ironkey will also, for each of the
(key . map)
pairs, force the binding ofkey
inmap
to have higher priority whenmap
is active in the current buffer. This is done by theironkey-update
function, which can also be called manually to refresh the status.
This package is not on Melpa, so the best ways would be to use straight.el or quelpa.el.
Alternatively one could download the files to one's load path and require 'ironkey
.
Example using straight
and use-package
:
(use-package ironkey
:straight (:type git :host github :repo "JimDBh/ironkey")
:demand t
:hook ((after-init . ironkey-update))
:config
(setq ironkey-iron-alist `((,(kbd "M-.") . nil) ;; command in global-map
(,(kbd "C-x p") . nil) ;; prefix keymap in global-map
(,(kbd "<tab>") . company-mode))) ;; command in minor mode map
(ironkey-mode t))
The custom variable ironkey-iron-alist
should be set as an alist of (key . map)
pairs. Note key
should be an internal representation of the key
combo, which can usually be obtained by the kbd
function. For example:
(setq ironkey-iron-alist `((,(kbd "M-.") . nil)
(,(kbd "<tab>") . company-mode-map)))
Next just simply turn on the global ironkey-mode
.
Currently there are no way to force set a protected key binding. Therefore if
one needs to update a protected key's binding, please temporarily turn off
ironkey-mode
and then turn it on again afterwards.
See CONTRIBUTING.md
for details.
Apache 2.0; see LICENSE
for details.
This project is not an official Google project. It is not supported by Google and Google specifically disclaims all warranties as to its quality, merchantability, or fitness for a particular purpose.