     :L cannot be in a :map.
 
 Flags
-    (:map [KEYMAP] [...])      ; inner keybinds are applied to KEYMAP(S)
-    (:map* [KEYMAP] [...])     ; same as :map, but deferred
+    (:mode [MODE(s)] [...])    ; inner keybinds are applied to major MODE(s)
+    (:map [KEYMAP(s)] [...])   ; inner keybinds are applied to KEYMAP(S)
+    (:map* [KEYMAP(s)] [...])  ; same as :map, but deferred
     (:prefix [PREFIX] [...])   ; assign prefix to all inner keybindings
     (:after [FEATURE] [...])   ; apply keybinds when [FEATURE] loads
 

(defvar doom-localleader-key "\\"
  "The leader prefix key, for global commands.")

(defvar doom--which-key-defs '(nil))


(def-package! which-key
  :defer 1
  :config
  (setq which-key-sort-order #'which-key-key-order-alpha
        which-key-sort-uppercase-first nil
        which-key-add-column-padding 1
        which-key-max-display-columns nil
        which-key-min-display-lines 10
        ;; only pop-up for leader/localleader keys
        which-key-allow-regexps (list (format "^%s" (regexp-quote doom-leader-key))
                                      (format "^%s" (regexp-quote doom-localleader-key))))
  ;; embolden local bindings
  (set-face-attribute 'which-key-local-map-description-face nil :weight 'bold)
  (which-key-setup-side-window-bottom)
  (which-key-mode +1)
  (when (cdr doom--which-key-defs)
    (apply #'which-key-add-key-based-replacements (cdr doom--which-key-defs))))


(defun doom-keyword-to-states (keyword &optional ignore)
  (let ((states '(("n" . normal)
                  ("v" . visual)
                  ("i" . insert)

  (let ((keymaps (if (boundp 'keymaps) keymaps))
        (prefix  (if (boundp 'prefix) prefix))
        (defer   (if (boundp 'defer) defer))
        local key def states forms desc modes)
    (while rest
      (setq key (pop rest))
      (cond
