dotemacs

My Emacs configuration
git clone git://git.entf.net/dotemacs
Log | Files | Refs | LICENSE

README.org (28032B)


      1 * which-key
      2   [[https://elpa.gnu.org/packages/which-key.html][https://elpa.gnu.org/packages/which-key.svg]]
      3   [[http://melpa.org/#/which-key][http://melpa.org/packages/which-key-badge.svg]]
      4   [[http://stable.melpa.org/#/which-key][file:http://stable.melpa.org/packages/which-key-badge.svg]]
      5 
      6 ** Recent Changes
      7 *** 2021-06-21: Add support for menu-item bindings
      8     =which-key= will now detect and compute the result of =menu-item=
      9     bindings. As a consequence of reworking the internals,
     10     =which-key-enable-extended-define-key= is now obsolete (the associated
     11     behavior is supported by default).
     12 
     13 *** 2020-08-28: Added =which-key-add-keymap-based-replacements=
     14     This function provides an alternative interface allowing replacements to be
     15     stored directly in keymaps, allowing one to avoid using
     16     =which-key-replacement-alist=, which may cause performance issues when it
     17     gets very big.
     18 *** 2019-08-01: Added =which-key-show-early-on-C-h=
     19     Allows one to trigger =which-key= on demand, rather than automatically. See
     20     the docstring and [[#manual-activation][Manual Activation]].
     21 
     22 *** 2017-12-13: Added =which-key-enable-extended-define-key=
     23     Allows for a concise syntax to specify replacement text using =define-key=
     24     or alternatives that use =define-key= internally. See the docstring and
     25     [[#custom-string-replacement-options][Custom String Replacement]].
     26 
     27 *** 2017-11-13: Added =which-key-show-major-mode=
     28     Shows active bindings in current major-mode map.
     29 ** Introduction
     30    =which-key= is a minor mode for Emacs that displays the key bindings
     31    following your currently entered incomplete command (a prefix) in a
     32    popup. For example, after enabling the minor mode if you enter =C-x= and wait
     33    for the default of 1 second the minibuffer will expand with all of the
     34    available key bindings that follow =C-x= (or as many as space allows given
     35    your settings).  This includes prefixes like =C-x 8= which are shown in a
     36    different face. Screenshots of what the popup will look like are included
     37    below. =which-key= started as a rewrite of [[https://github.com/kai2nenobu/guide-key][guide-key-mode]], but the feature
     38    sets have diverged to a certain extent.
     39 
     40 ** Table of Contents                                                  :TOC_3:
     41 - [[#which-key][which-key]]
     42   - [[#recent-changes][Recent Changes]]
     43     - [[#2021-06-21-add-support-for-menu-item-bindings][2021-06-21: Add support for menu-item bindings]]
     44     - [[#2020-08-28-added-which-key-add-keymap-based-replacements][2020-08-28: Added =which-key-add-keymap-based-replacements=]]
     45     - [[#2019-08-01-added-which-key-show-early-on-c-h][2019-08-01: Added =which-key-show-early-on-C-h=]]
     46     - [[#2017-12-13-added-which-key-enable-extended-define-key][2017-12-13: Added =which-key-enable-extended-define-key=]]
     47     - [[#2017-11-13-added-which-key-show-major-mode][2017-11-13: Added =which-key-show-major-mode=]]
     48   - [[#introduction][Introduction]]
     49   - [[#install][Install]]
     50     - [[#melpa][MELPA]]
     51     - [[#manually][Manually]]
     52   - [[#initial-setup][Initial Setup]]
     53     - [[#side-window-bottom-option][Side Window Bottom Option]]
     54     - [[#side-window-right-option][Side Window Right Option]]
     55     - [[#side-window-right-then-bottom][Side Window Right then Bottom]]
     56     - [[#minibuffer-option][Minibuffer Option]]
     57   - [[#manual-activation][Manual Activation]]
     58   - [[#additional-commands][Additional Commands]]
     59   - [[#special-features-and-configuration-options][Special Features and Configuration Options]]
     60     - [[#popup-type-options][Popup Type Options]]
     61     - [[#custom-string-replacement-options][Custom String Replacement Options]]
     62     - [[#sorting-options][Sorting Options]]
     63     - [[#paging-options][Paging Options]]
     64     - [[#face-customization-options][Face Customization Options]]
     65     - [[#other-options][Other Options]]
     66   - [[#support-for-third-party-libraries][Support for Third-Party Libraries]]
     67     - [[#key-chord][Key-chord]]
     68     - [[#evil-operators][Evil operators]]
     69     - [[#god-mode][God-mode]]
     70   - [[#more-examples][More Examples]]
     71     - [[#nice-display-with-split-frame][Nice Display with Split Frame]]
     72   - [[#known-issues][Known Issues]]
     73   - [[#thanks][Thanks]]
     74 
     75 ** Install
     76 *** MELPA
     77     After setting up [[http://melpa.org][MELPA]] as a repository, use =M-x package-install which-key=
     78     or your preferred method. You will need to call =which-key-mode= to enable
     79     the minor mode of course.
     80 
     81 *** Manually
     82     Add which-key.el to your =load-path= and require. Something like
     83     #+BEGIN_SRC emacs-lisp
     84     (add-to-list 'load-path "path/to/which-key.el")
     85     (require 'which-key)
     86     (which-key-mode)
     87     #+END_SRC
     88 
     89 ** Initial Setup
     90    No further setup is required if you are happy with the default setup. To try
     91    other options, there are 3 choices of default configs that are preconfigured
     92    (then customize to your liking). The main choice is where you want the
     93    which-key buffer to display. Screenshots of the default options are shown in
     94    the next sections.
     95 
     96    In each case, we show as many key bindings as we can fit in the buffer within
     97    the constraints. The constraints are determined by several factors, including
     98    your Emacs settings, the size of the current Emacs frame, and the which-key
     99    settings, most of which are described below.
    100 
    101    There are many substitution abilities included, which are quite flexible
    102    (ability to use regexp for example). This makes which-key very customizable.
    103 
    104 *** Side Window Bottom Option
    105     Popup side window on bottom. This is the current default. To restore this
    106     setup use
    107 
    108     #+BEGIN_SRC emacs-lisp
    109 (which-key-setup-side-window-bottom)
    110     #+END_SRC
    111 
    112     [[./img/which-key-bottom.png]]
    113 
    114 *** Side Window Right Option
    115     Popup side window on right. For defaults use
    116 
    117     #+BEGIN_SRC emacs-lisp
    118 (which-key-setup-side-window-right)
    119     #+END_SRC
    120 
    121     Note the defaults are fairly conservative and will tend to not display on
    122     narrower frames. If you get a message saying which-key can't display the
    123     keys, try making your frame wider or adjusting the defaults related to the
    124     maximum width (see =M-x customize-group which-key=).
    125 
    126     [[./img/which-key-right.png]]
    127 
    128 *** Side Window Right then Bottom
    129     This is a combination of the previous two choices. It will try to use the
    130     right side, but if there is no room it will switch to using the bottom,
    131     which is usually easier to fit keys into. This setting can be helpful if the
    132     size of the Emacs frame changes frequently, which might be the case if you
    133     are using a dynamic/tiling window manager.
    134 
    135     #+BEGIN_SRC emacs-lisp
    136     (which-key-setup-side-window-right-bottom)
    137     #+END_SRC
    138 
    139 *** Minibuffer Option
    140     Take over the minibuffer. For the recommended configuration use
    141 
    142     #+BEGIN_SRC emacs-lisp
    143     (which-key-setup-minibuffer)
    144     #+END_SRC
    145 
    146     [[./img/which-key-minibuffer.png]]
    147 
    148     Note the maximum height of the minibuffer is controlled through the built-in
    149     variable =max-mini-window-height=. Also, the paging commands do not work
    150     reliably with the minibuffer option. Use the side window on the bottom
    151     option if you need paging.
    152 
    153 ** Manual Activation
    154    #+NAME: #manual-activation
    155    If you only want the =which-key= popup when you need it, you can try a setup
    156    along the following lines
    157 
    158    #+BEGIN_SRC emacs-lisp
    159      ;; Allow C-h to trigger which-key before it is done automatically
    160      (setq which-key-show-early-on-C-h t)
    161      ;; make sure which-key doesn't show normally but refreshes quickly after it is
    162      ;; triggered.
    163      (setq which-key-idle-delay 10000)
    164      (setq which-key-idle-secondary-delay 0.05)
    165      (which-key-mode)
    166    #+END_SRC
    167 
    168    This will prevent which-key from showing automatically, and allow you to use
    169    =C-h= in the middle of a key sequence to show the =which-key= buffer and keep
    170    it open for the remainder of the key sequence.
    171 
    172 ** Additional Commands
    173    - =which-key-show-top-level= will show most key bindings without a prefix. It
    174      is most and not all, because many are probably not interesting to most
    175      users.
    176    - =which-key-show-major-mode= will show the currently active major-mode
    177      bindings. It's similar to =C-h m= but in a which-key format. It is also
    178      aware of evil commands defined using =evil-define-key=.
    179    - =which-key-show-next-page-cycle= / =which-key-show-previous-page-cycle= will flip pages in a circle.
    180    - =which-key-show-next-page-no-cycle= / =which-key-show-previous-page-no-cycle= will flip pages and stop at first/last page.
    181    - =which-key-undo= can be used to undo the last keypress when in the middle
    182      of a key sequence.
    183 
    184 ** Special Features and Configuration Options
    185    There are more options than the ones described here. All of the configurable
    186    variables are available through =M-x customize-group which-key=.
    187 *** Popup Type Options
    188     There are three different popup types that which-key can use by default to
    189     display the available keys. The variable =which-key-popup-type= decides
    190     which one is used.
    191 **** minibuffer
    192      #+BEGIN_SRC emacs-lisp
    193      (setq which-key-popup-type 'minibuffer)
    194      #+END_SRC
    195      Show keys in the minibuffer.
    196 **** side window
    197      #+BEGIN_SRC emacs-lisp
    198      (setq which-key-popup-type 'side-window)
    199      #+END_SRC
    200      Show keys in a side window. This popup type has further options:
    201      #+BEGIN_SRC emacs-lisp
    202      ;; location of which-key window. valid values: top, bottom, left, right,
    203      ;; or a list of any of the two. If it's a list, which-key will always try
    204      ;; the first location first. It will go to the second location if there is
    205      ;; not enough room to display any keys in the first location
    206      (setq which-key-side-window-location 'bottom)
    207 
    208      ;; max width of which-key window, when displayed at left or right.
    209      ;; valid values: number of columns (integer), or percentage out of current
    210      ;; frame's width (float larger than 0 and smaller than 1)
    211      (setq which-key-side-window-max-width 0.33)
    212 
    213      ;; max height of which-key window, when displayed at top or bottom.
    214      ;; valid values: number of lines (integer), or percentage out of current
    215      ;; frame's height (float larger than 0 and smaller than 1)
    216      (setq which-key-side-window-max-height 0.25)
    217      #+END_SRC
    218 **** frame
    219 
    220      #+BEGIN_SRC emacs-lisp
    221      (setq which-key-popup-type 'frame)
    222      #+END_SRC
    223      Show keys in a popup frame. This popup won't work very well in a terminal,
    224      where only one frame can be shown at any given moment. This popup type has
    225      further options:
    226      #+BEGIN_SRC emacs-lisp
    227      ;; max width of which-key frame: number of columns (an integer)
    228      (setq which-key-frame-max-width 60)
    229 
    230      ;; max height of which-key frame: number of lines (an integer)
    231      (setq which-key-frame-max-height 20)
    232      #+END_SRC
    233 
    234 **** custom
    235      Write your own display functions! This requires you to write three
    236      functions, =which-key-custom-popup-max-dimensions-function=,
    237      =which-key-custom-show-popup-function=, and
    238      =which-key-custom-hide-popup-function=. Refer to the documentation for
    239      those variables for more information, but here is a working example (this
    240      is the current implementation of side-window bottom).
    241 
    242 
    243      #+BEGIN_SRC emacs-lisp
    244        (setq which-key-popup-type 'custom)
    245        (defun which-key-custom-popup-max-dimensions-function (ignore)
    246          (cons
    247           (which-key-height-or-percentage-to-height
    248            which-key-side-window-max-height)
    249           (frame-width)))
    250        (defun fit-horizonatally ()
    251          (let ((fit-window-to-buffer-horizontally t))
    252            (fit-window-to-buffer)))
    253        (defun which-key-custom-show-popup-function (act-popup-dim)
    254          (let* ((alist '((window-width . fit-horizontally)
    255                          (window-height . fit-window-to-buffer))))
    256            (if (get-buffer-window which-key--buffer)
    257                (display-buffer-reuse-window which-key--buffer alist)
    258              (display-buffer-in-major-side-window which-key--buffer
    259                                                   'bottom 0 alist))))
    260        (defun which-key-custom-hide-popup-function ()
    261          (when (buffer-live-p which-key--buffer)
    262            (quit-windows-on which-key--buffer)))
    263      #+END_SRC
    264 
    265 *** Custom String Replacement Options
    266     #+NAME: #custom-string-replacement-options
    267     You can customize the way the keys show in the buffer using three different
    268     replacement methods. The first, keymap-based replacement, is preferred and
    269     will take precedence over the others. The remaining methods are still
    270     available, because they pre-date the first and are more flexible in what
    271     they can accomplish.
    272 
    273 **** Keymap-based replacement
    274      Using this method, which-key can display a custom string for a key
    275      definition in some keymap. There are two ways to define a keymap-based
    276      replacement. The preferred way is to use =define-key= (or a command that
    277      uses =define-key= internally) with a cons cell as the definition. For
    278      example,
    279 
    280      #+BEGIN_SRC emacs-lisp
    281      (define-key some-map "f" '("foo" . command-foo))
    282      (define-key some-map "b" '("bar-prefix" . (keymap)))
    283      #+END_SRC
    284 
    285      binds =command-foo= to =f= in =some-map=, but also stores the string "foo"
    286      which which-key will extract to use to describe this command. The second
    287      example binds an empty keymap to =b= in =some-map= and uses "bar-prefix" to
    288      describe it. These bindings are accepted by =define-key= natively (i.e.,
    289      with or without which-key being loaded). Since many key-binding utilities
    290      use =define-key= internally, this functionality should be available with
    291      your favorite method of defining keys as well.
    292 
    293      The second method is to use =which-key-add-keymap-based-replacements=. The
    294      statement
    295 
    296      #+BEGIN_SRC emacs-lisp
    297        (define-key some-map "f" 'long-command-name-foo)
    298        (define-key some-map "b" some-prefix-map)
    299        (which-key-add-keymap-based-replacements some-map
    300          "f" '("foo" . long-command-name-foo)
    301          "b" '("bar-prefix" . (keymap)))
    302      #+END_SRC
    303 
    304      uses =define-key= to add two bindings and tells which-key to use the string
    305      "foo" in place of "command-foo" and the string "bar-prefix" for an empty
    306      prefix map. =which-key-add-keymap-based-replacements= just uses
    307      =define-key= to bind (or rebind) the command.
    308 
    309      There are other methods of telling which-key to replace command names,
    310      which are described next. The keymap-based replacements should be the most
    311      performant since they use built-in functionality of emacs. However, the
    312      alternatives can be more flexible in telling which-key how and when to
    313      replace text. They can be used simultaneously, but which-key will give
    314      precedence to the keymap-based replacement when it exists.
    315 
    316 **** Key-Based replacement
    317      Using this method, the description of a key is replaced using a string that
    318      you provide. Here's an example
    319 
    320      #+BEGIN_SRC emacs-lisp
    321      (which-key-add-key-based-replacements
    322        "C-x C-f" "find files")
    323      #+END_SRC
    324 
    325      where the first string is the key combination whose description you want to
    326      replace, in a form suitable for =kbd=. For that key combination, which-key
    327      overwrites the description with the second string, "find files". In the
    328      second type of entry you can restrict the replacements to a major-mode. For
    329      example,
    330 
    331      #+BEGIN_SRC emacs-lisp
    332      (which-key-add-major-mode-key-based-replacements 'org-mode
    333        "C-c C-c" "Org C-c C-c"
    334        "C-c C-a" "Org Attach")
    335      #+END_SRC
    336 
    337      Here the first entry is the major-mode followed by a list of the first type
    338      of entries. In case the same key combination is listed under a major-mode
    339      and by itself, the major-mode version takes precedence.
    340 
    341 **** Key and Description replacement
    342 
    343      The second and third methods target the text used for the keys and the
    344      descriptions directly. The relevant variable is
    345      =which-key-replacement-alist=.  Here's an example of one of the default key
    346      replacements
    347 
    348      #+BEGIN_SRC emacs-lisp
    349      (push '(("<\\([[:alnum:]-]+\\)>" . nil) . ("\\1" . nil))
    350            which-key-replacement-alist)
    351      #+END_SRC
    352 
    353      Each element of the outer cons cell is a cons cell of the form =(KEY
    354      . BINDING)=. The =car= of the outer cons determines how to match key
    355      bindings while the =cdr= determines how those matches are replaced. See the
    356      docstring of =which-key-replacement-alist= for more information.
    357 
    358      The next example shows how to replace the description.
    359 
    360      #+BEGIN_SRC emacs-lisp
    361      (push '((nil . "left") . (nil . "lft")) which-key-replacement-alist)
    362      #+END_SRC
    363 
    364      Here is an example of using key replacement to include Unicode characters
    365      in the results. Unfortunately, using Unicode characters may upset the
    366      alignment of the which-key buffer, because Unicode characters can have
    367      different widths even in a monospace font and alignment is based on
    368      character width.
    369 
    370      #+BEGIN_SRC emacs-lisp
    371      (add-to-list 'which-key-replacement-alist '(("TAB" . nil) . ("↹" . nil)))
    372      (add-to-list 'which-key-replacement-alist '(("RET" . nil) . ("⏎" . nil)))
    373      (add-to-list 'which-key-replacement-alist '(("DEL" . nil) . ("⇤" . nil)))
    374      (add-to-list 'which-key-replacement-alist '(("SPC" . nil) . ("␣" . nil)))
    375      #+END_SRC
    376 
    377      The =cdr= may also be a function that receives a =cons= of the form =(KEY
    378      . BINDING)= and produces a =cons= of the same form. This allows for
    379      interesting ideas like this one suggested by [[https://github.com/pdcawley][@pdcawley]] in [[https://github.com/justbur/emacs-which-key/pull/147][PR #147]].
    380 
    381      #+BEGIN_SRC emacs-lisp
    382      (push (cons '(nil . "paredit-mode")
    383                  (lambda (kb)
    384                    (cons (car kb)
    385                          (if paredit-mode
    386                              "[x] paredit-mode"
    387                            "[ ] paredit-mode"))))
    388            which-key-replacement-alist)
    389      #+END_SRC
    390 
    391      The box will be checked if =paredit-mode= is currently active.
    392 
    393 *** Sorting Options
    394     By default the output is sorted by the key in a custom order. The default
    395     order is to sort lexicographically within each "class" of key, where the
    396     classes and their order are
    397 
    398     =Special (SPC, TAB, ...) < Single Character (ASCII) (a, ...) < Modifier (C-, M-, ...) < Other=
    399 
    400     You can control the order by setting this variable. This also shows the
    401     other available options.
    402 
    403     #+BEGIN_SRC emacs-lisp
    404     ;; default
    405     (setq which-key-sort-order 'which-key-key-order)
    406     ;; same as default, except single characters are sorted alphabetically
    407     ;; (setq which-key-sort-order 'which-key-key-order-alpha)
    408     ;; same as default, except all prefix keys are grouped together at the end
    409     ;; (setq which-key-sort-order 'which-key-prefix-then-key-order)
    410     ;; same as default, except all keys from local maps shown first
    411     ;; (setq which-key-sort-order 'which-key-local-then-key-order)
    412     ;; sort based on the key description ignoring case
    413     ;; (setq which-key-sort-order 'which-key-description-order)
    414     #+END_SRC
    415 
    416 *** Paging Options
    417 
    418     There are at least several prefixes that have many keys bound to them, like
    419     =C-x=. which-key displays as many keys as it can given your settings, but
    420     for these prefixes this may not be enough. The paging feature gives you the
    421     ability to bind a key to the function =which-key-C-h-dispatch= which will
    422     allow you to cycle through the pages without changing the key sequence you
    423     were in the middle of typing. There are two slightly different ways of doing
    424     this.
    425 
    426 **** Method 1 (default): Using C-h (or =help-char=)
    427      This is the easiest way, and is turned on by default. Use
    428      #+BEGIN_SRC emacs-lisp
    429      (setq which-key-use-C-h-commands nil)
    430      #+END_SRC
    431      to disable the behavior (this will only take effect after toggling
    432      which-key-mode if it is already enabled). =C-h= can be used with any prefix
    433      to switch pages when there are multiple pages of keys. This changes the
    434      default behavior of Emacs which is to show a list of key bindings that
    435      apply to a prefix.  For example, if you were to type =C-x C-h= you would
    436      get a list of commands that follow =C-x=. This uses which-key instead to
    437      show those keys, and unlike the Emacs default saves the incomplete prefix
    438      that you just entered so that the next keystroke can complete the command.
    439 
    440      The commands are:
    441      - Cycle through the pages forward with =n= (or =C-n=)
    442      - Cycle backwards with =p= (or =C-p=)
    443      - Undo the last entered key (!) with =u= (or =C-u=)
    444      - Call the default command bound to =C-h=, usually
    445        =describe-prefix-bindings=, with =h= (or =C-h=)
    446 
    447   This is especially useful for those who like =helm-descbinds= but also want to
    448   use =C-h= as their which-key paging key.
    449 
    450   Note =C-h= is by default equivalent to =?= in this context.
    451 
    452   Note also that using =C-h= will not work with the =C-h= prefix, unless you
    453   make further adjustments. See Issues [[https://github.com/justbur/emacs-which-key/issues/93][#93]] and [[https://github.com/justbur/emacs-which-key/issues/175][#175]] for example.
    454 
    455 **** Method 2: Bind your own keys
    456 
    457      Essentially, all you need to do for a prefix like =C-x= is the following
    458      which will bind =<f5>= to the relevant command.
    459 
    460      #+BEGIN_SRC emacs-lisp
    461 (define-key which-key-mode-map (kbd "C-x <f5>") 'which-key-C-h-dispatch)
    462      #+END_SRC
    463 
    464      This is completely equivalent to
    465 
    466      #+BEGIN_SRC emacs-lisp
    467 (setq which-key-paging-prefixes '("C-x"))
    468 (setq which-key-paging-key "<f5>")
    469      #+END_SRC
    470 
    471      where the latter are provided for convenience if you have a lot of
    472      prefixes.
    473 
    474 *** Face Customization Options
    475     The faces that which-key uses are
    476     | Face                                   | Applied To                    | Default Definition                                          |
    477     |----------------------------------------+-------------------------------+-------------------------------------------------------------|
    478     | =which-key-key-face=                   | Every key sequence            | =:inherit font-lock-constant-face=                          |
    479     | =which-key-separator-face=             | The separator (→)             | =:inherit font-lock-comment-face=                           |
    480     | =which-key-note-face=                  | Hints and notes               | =:inherit which-key-separator-face=                         |
    481     | =which-key-special-key-face=           | User-defined special keys     | =:inherit which-key-key-face :inverse-video t :weight bold= |
    482     | =which-key-group-description-face=     | Command groups (i.e, keymaps) | =:inherit font-lock-keyword-face=                           |
    483     | =which-key-command-description-face=   | Commands not in local-map     | =:inherit font-lock-function-name-face=                     |
    484     | =which-key-local-map-description-face= | Commands in local-map         | =:inherit which-key-command-description-face=               |
    485 
    486     The last two deserve some explanation. A command lives in one of many possible
    487     keymaps. You can distinguish between local maps, which depend on the buffer you
    488     are in, which modes are active, etc., and the global map which applies
    489     everywhere. It might be useful for you to distinguish between the two. One way
    490     to do this is to remove the default face from
    491     =which-key-command-description-face= like this
    492 
    493     #+BEGIN_SRC emacs-lisp
    494   (set-face-attribute 'which-key-command-description-face nil :inherit nil)
    495     #+END_SRC
    496 
    497     another is to make the local map keys appear in bold
    498 
    499     #+BEGIN_SRC emacs-lisp
    500   (set-face-attribute 'which-key-local-map-description-face nil :weight 'bold)
    501     #+END_SRC
    502 
    503     You can also use =M-x customize-face= to customize any of the above faces to
    504     your liking.
    505 
    506 *** Other Options
    507     #+NAME: #other-options
    508     The options below are also available through customize. Their defaults are
    509     shown.
    510 
    511     #+BEGIN_SRC emacs-lisp
    512       ;; Set the time delay (in seconds) for the which-key popup to appear. A value of
    513       ;; zero might cause issues so a non-zero value is recommended.
    514       (setq which-key-idle-delay 1.0)
    515 
    516       ;; Set the maximum length (in characters) for key descriptions (commands or
    517       ;; prefixes). Descriptions that are longer are truncated and have ".." added.
    518       (setq which-key-max-description-length 27)
    519 
    520       ;; Use additional padding between columns of keys. This variable specifies the
    521       ;; number of spaces to add to the left of each column.
    522       (setq which-key-add-column-padding 0)
    523 
    524       ;; The maximum number of columns to display in the which-key buffer. nil means
    525       ;; don't impose a maximum.
    526       (setq which-key-max-display-columns nil)
    527 
    528       ;; Set the separator used between keys and descriptions. Change this setting to
    529       ;; an ASCII character if your font does not show the default arrow. The second
    530       ;; setting here allows for extra padding for Unicode characters. which-key uses
    531       ;; characters as a means of width measurement, so wide Unicode characters can
    532       ;; throw off the calculation.
    533       (setq which-key-separator " → " )
    534       (setq which-key-unicode-correction 3)
    535 
    536       ;; Set the prefix string that will be inserted in front of prefix commands
    537       ;; (i.e., commands that represent a sub-map).
    538       (setq which-key-prefix-prefix "+" )
    539 
    540       ;; Set the special keys. These are automatically truncated to one character and
    541       ;; have which-key-special-key-face applied. Disabled by default. An example
    542       ;; setting is
    543       ;; (setq which-key-special-keys '("SPC" "TAB" "RET" "ESC" "DEL"))
    544       (setq which-key-special-keys nil)
    545 
    546       ;; Show the key prefix on the left, top, or bottom (nil means hide the prefix).
    547       ;; The prefix consists of the keys you have typed so far. which-key also shows
    548       ;; the page information along with the prefix.
    549       (setq which-key-show-prefix 'left)
    550 
    551       ;; Set to t to show the count of keys shown vs. total keys in the mode line.
    552       (setq which-key-show-remaining-keys nil)
    553     #+END_SRC
    554 ** Support for Third-Party Libraries
    555    Some support is provided for third-party libraries which don't use standard
    556    methods of looking up commands. Some of these need to be enabled
    557    explicitly. This code includes some hacks, so please report any problems.
    558 *** Key-chord
    559     Enabled by default.
    560 *** Evil operators
    561     Evil motions and text objects following an operator like =d= are not all
    562     looked up in a standard way. Support is controlled through
    563     =which-key-allow-evil-operators= which should be non-nil if evil is loaded
    564     before which-key and through =which-key-show-operator-state-maps= which
    565     needs to be enabled explicitly because it is more of a hack. The former
    566     allows for the inner and outer text object maps to show, while the latter
    567     shows motions as well.
    568 *** God-mode
    569     Call =(which-key-enable-god-mode-support)= after loading god-mode to enable
    570     support for god-mode key sequences. This is new and experimental, so please
    571     report any issues.
    572 ** More Examples
    573 *** Nice Display with Split Frame
    574     Unlike guide-key, which-key looks good even if the frame is split into
    575     several windows.
    576     #+CAPTION: which-key in a frame with 3 horizontal splits
    577     [[./img/which-key-right-split.png]]
    578 
    579     #+CAPTION: which-key in a frame with 2 vertical splits
    580     [[./img/which-key-bottom-split.png]]
    581 ** Known Issues
    582    - A few users have reported crashes related to which-key popups when quitting
    583      a key sequence with =C-g=. A possible fix is discussed in [[https://github.com/justbur/emacs-which-key/issues/130][this issue]].
    584 ** Thanks
    585    Special thanks to
    586    - [[https://github.com/bmag][@bmag]] for helping with the initial development and finding many bugs.
    587    - [[https://github/iqbalansari][@iqbalansari]] who among other things adapted the code to make
    588      =which-key-show-top-level= possible.