[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bind-map 6d05297e3c 20/97: Add another example and more de
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bind-map 6d05297e3c 20/97: Add another example and more detail to README |
Date: |
Thu, 20 Jan 2022 07:59:10 -0500 (EST) |
branch: elpa/bind-map
commit 6d05297e3c384a9efee5aafeebabe3c420e72719
Author: justbur <justin@burkett.cc>
Commit: justbur <justin@burkett.cc>
Add another example and more detail to README
---
README.org | 55 ++++++++++++++++++++++++++++++++++---------------------
1 file changed, 34 insertions(+), 21 deletions(-)
diff --git a/README.org b/README.org
index 588dcab8f2..93399ebada 100644
--- a/README.org
+++ b/README.org
@@ -7,27 +7,32 @@ used in vim or the Emacs
[[https://github.com/cofi/evil-leader][evil-leader]] pa
of "leader keys". This is probably best explained with an example.
#+BEGIN_SRC emacs-lisp
-(bind-map my-lisp-map
+(bind-map my-base-leader-map
:keys ("M-m")
:evil-keys ("SPC")
- :evil-states (normal visual)
+ :evil-states (normal motion visual))
+(bind-map my-elisp-map
+ :keys ("M-m m" "M-RET")
+ :evil-keys ("SPC m" ",")
:major-modes (emacs-lisp-mode
- lisp-interaction-mode
- lisp-mode))
+ lisp-interaction-mode))
#+END_SRC
-This will take =my-lisp-map= and make it available under the prefixes (or
-leaders) =M-m= and =SPC=, where the latter is only bound in evil's normal or
-visual state (defaults in =bind-map-default-evil-states=) when one of the
-specified major mode is active (there is no need to make sure the respective
-modes' packages are loaded before this declaration). It is also possible to
make
-the bindings conditional on minor modes being loaded, or a mix of major and
-minor modes. If no modes are specified, the relevant global maps are used. See
-the docstring of =bind-map= for more options.
+This will make =my-base-leader-map= (automatically creating the map if it's not
+defined yet) available under the prefixes (or leaders) =M-m= and =SPC=, where
+the latter is only bound in evil's normal, motion or visual states. The second
+declaration makes =my-elisp-map= available under the specified keys when one of
+the specified major modes is active. In the second case, the evil states used
+are also normal motion and visual because this is the default as specified in
+=bind-map-default-evil-states=. It is possible to make the bindings conditional
+on minor modes being loaded, or a mix of major and minor modes. Since the
+symbols of the modes are used, it is not necessary to ensure that any of the
+mode's packages are loaded prior to this declaration. See the docstring of
+=bind-map= for more options.
The idea behind this package is that you want to organize your personal
bindings
in a series of keymaps separate from built-in mode maps. You can simply add
keys
-using the built-in =define-key= to =my-lisp-map= for example, and a declaration
+using the built-in =define-key= to =my-elisp-map= for example, and a
declaration
like the one above will take care of ensuring that these bindings are available
in the correct places.
@@ -39,16 +44,24 @@ use =define-key= internally, but allow for multiple
bindings without much
syntax.
#+BEGIN_SRC emacs-lisp
-(bind-map-set-keys my-lisp-map
- "c" 'compile
- "C" 'check
+ (bind-map-set-keys my-base-leader-map
+ "c" 'compile
+ "C" 'check
+ ;; ...
+ )
+ ;; is the same as
+ ;; (define-key my-base-leader-map (kbd "c") 'compile)
+ ;; (define-key my-base-leader-map (kbd "C") 'check)
;; ...
- )
-(bind-map-set-key-defaults my-lisp-map
- "c" 'compile
- "C" 'check
+
+ (bind-map-set-key-defaults my-base-leader-map
+ "c" 'compile
+ ;; ...
+ )
+ ;; is the same as
+ ;; (unless (lookup-key my-base-leader-map (kbd "c"))
+ ;; (define-key my-base-leader-map (kbd "c") 'compile))
;; ...
- )
#+END_SRC
The second function only adds the bindings if there is no existing binding for
- [nongnu] elpa/bind-map 115e0459bf 05/97: Bring back set-keys function, (continued)
- [nongnu] elpa/bind-map 115e0459bf 05/97: Bring back set-keys function, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map d7aee3c6ab 09/97: Note helper funcs in README, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map a8a2937ecc 38/97: Minor tweak to previous commit, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map faaa33d909 77/97: Prefer eval-after-load to require for evil funcs, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 61fe55e097 17/97: Can't simply use cl-pushnew, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 5508980148 69/97: Account for multiple declarations of the same map, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map b05ea98102 37/97: Add option to use local state maps, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 7d20946692 04/97: Add autoloads, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 7de08fe592 43/97: Move a defvar and reword docstring, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map bb7a8b2258 59/97: Remove declare-function from previous commit, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 6d05297e3c 20/97: Add another example and more detail to README,
ELPA Syncer <=
- [nongnu] elpa/bind-map d47be94d23 63/97: Don't try to bind keys that are nil or "", ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map ebc4c9fb11 34/97: Remove bind-map-kbd hack, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 8ec4516db2 48/97: Remove use of evil-define-key, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map c182707793 41/97: Remove unnecessary helper functions and reorg, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map b0b9e18947 66/97: Revert last commit, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map f51d4b0c0d 79/97: Add bind-map-for-modes-derived, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 21b7ba7eca 30/97: Fix some docstrings, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map cc1db8958c 64/97: Version 0.1, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 988f14eb77 65/97: Use evil-define-minor-mode-key for minor-mode keys, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 292794739c 71/97: Fix incorrect check of override mode in local hook, ELPA Syncer, 2022/01/20