Note: This project is not under active development and has a range of issues. You might be better using something else.
key-combo is an Emacs package that provides "cycling" key-binding. Multiple commands are executed sequentially with a repeated keypress of a single key. Multi-key cords can also be bound to a sequences of characters or commands in order to create complex "smart operator" effects.
This package is available from MELPA. Alternatively you
key-combo.el into your emacs path and add
(require 'key-combo) to
your init file.
key-combo-mode localy in a mode hook with:
or globally with
Define cycling key combos globally with
(key-combo-define-global "=" '(" = " " == " " === " )) ;cycling (key-combo-define-global "=>" " => ") (key-combo-define-global "C-a" `(back-to-indentation move-beginning-of-line beginning-of-buffer key-combo-return)) (key-combo-define-global "C-e" '(move-end-of-line end-of-buffer key-combo-return))
or for each modes separately:
(key-combo-define emacs-lisp-mode-map "=" '("= " "eq " "equal "))
There is also
key-combo-define-local that should be used inside mode hooks.
To facilitate quick declaration of cord,
key-combo-define-hook which is used to setup same hook for a list of
modes. Here is a simple example for
(defvar my-lisp-mode-hooks '(lisp-mode-hook emacs-lisp-mode-hook lisp-interaction-mode-hook inferior-gauche-mode-hook scheme-mode-hook)) (defvar my-key-combos-for-lisp '(("." . ("." " . ")) ("," . (key-combo-execute-original)) (",@" . " ,@") (";=" . ";=> ") ("=" . ("= " "eq " "equal ")) (">=" . ">= "))) (key-combo-define-hook my-lisp-mode-hooks ; hooks 'my-key-combo-lisp-hook ; function name my-key-combos-for-lisp)
To load a range of default configurations for
etc modes, use:
key-combo is intended as a superset of the following projects:
Anything you can do with the above package you should be able to do with
key-combo, and much more.