/evil-owl

preview registers and marks before actually using them

Primary LanguageEmacs LispGNU General Public License v3.0GPL-3.0

Evil Owl

https://melpa.org/packages/evil-owl-badge.svg https://travis-ci.com/mamapanda/evil-owl.svg?branch=master

evil-owl allows you to view registers and marks before using them.

./img/registers.png

Basic Setup

This package can be installed from MELPA with M-x package-install [RET] evil-owl [RET]. Here’s a basic configuration with use-package:

(use-package evil-owl
  :config
  (setq evil-owl-max-string-length 500)
  (add-to-list 'display-buffer-alist
               '("*evil-owl*"
                 (display-buffer-in-side-window)
                 (side . bottom)
                 (window-height . 0.3)))
  (evil-owl-mode))

Alternatively, with posframe:

(use-package evil-owl
  :config
  (setq evil-owl-display-method 'posframe
        evil-owl-extra-posframe-args '(:width 50 :height 20)
        evil-owl-max-string-length 50)
  (evil-owl-mode))

Press q, @, ​"​, C-r, m, ​'​, or ` to view the popup, press C-f or C-b to scroll it, and input a register or mark to make the popup disappear.

Customization

Faces

evil-owl uses the following faces:

  • evil-owl-group-name for register/mark group names
  • evil-owl-entry-name for register/mark characters in each entry

You can edit them with custom-set-faces:

(custom-set-faces
 '(evil-owl-group-name ((t (:inherit font-lock-function-name-face))))
 '(evil-owl-entry-name ((t (:inherit font-lock-type-face)))))

Variables

The following options control formatting:

  • evil-owl-header-format for group headers
  • evil-owl-register-format for register entries
  • evil-owl-local-mark-format for local mark entries
  • evil-owl-global-mark-format for global mark entries
  • evil-owl-separator for separators between groups

Here are their default values:

(setq evil-owl-header-format      "%s"
      evil-owl-register-format    " %r: %s"
      evil-owl-local-mark-format  " %m: [l: %-5l, c: %-5c]"
      evil-owl-global-mark-format " %m: [l: %-5l, c: %-5c] %b"
      evil-owl-separator          "\n")

For evil-owl-local-mark-format and evil-owl-global-mark-format, a preview of the line corresponding to the stored mark can be viewed using something like the following:

(setq evil-owl-local-mark-format " %m: [l: %-5l, c: %-5c]\n    %s")
(setq evil-owl-global-mark-format " %m: [l: %-5l, c: %-5c] %b\n    %s")

evil-owl-register-groups and evil-owl-mark-groups determine register and mark groups, respectively, for display.

(setq evil-owl-register-groups
      `(("Named"     . ,(cl-loop for c from ?a to ?z collect c))
        ("Numbered"  . ,(cl-loop for c from ?0 to ?9 collect c))
        ("Special"   . (?\" ?* ?+ ?-))
        ("Read-only" . (?% ?# ?/ ?: ?.))))

(setq evil-owl-mark-groups
      `(("Named Local"  . ,(cl-loop for c from ?a to ?z collect c))
        ("Named Global" . ,(cl-loop for c from ?A to ?Z collect c))
        ("Numbered"     . ,(cl-loop for c from ?0 to ?9 collect c))
        ("Special"      . (?\[ ?\] ?< ?> ?^ ?\( ?\) ?{ ?}))))

evil-owl-display-method may be one of ​'​window or ​'​posframe and decides whether to pop up a window or posframe. If the value is ​'​posframe, the posframe package is expected to be installed.

(setq evil-owl-display-method 'window)

evil-owl-idle-delay dictates, in seconds, how long to wait before showing the window/posframe.

(setq evil-owl-idle-delay 1.0)

To customize the popup window, use display-buffer-alist with the buffer name *evil-owl*. For the posframe, evil-owl-extra-posframe-args holds extra arguments to pass to posframe-show.

;; if `evil-owl-display-method' is 'window
(add-to-list 'display-buffer-alist
             '("*evil-owl*"
               (display-buffer-in-side-window)
               (side . bottom)
               (window-height . 0.3)))

;; if `evil-owl-display-method' is 'posframe
(setq evil-owl-extra-posframe-args '(:width 50 :height 20))

evil-owl-max-string-length decides the maximum number of characters to consider in certain string values. If strings are too long, processing them can be slow, so it’s recommended to set this variable to a low value.

(setq evil-owl-max-string-length 100)

Inspirations