evil-owl icon indicating copy to clipboard operation
evil-owl copied to clipboard

preview registers and marks before actually using them

#+TITLE: Evil Owl #+AUTHOR: Daniel Phan

[[https://melpa.org/#/evil-owl][file:https://melpa.org/packages/evil-owl-badge.svg]] [[https://github.com/mamapanda/evil-owl/actions?query=workflow%3ACI][file:https://github.com/mamapanda/evil-owl/workflows/CI/badge.svg]]

~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~:

    #+BEGIN_SRC emacs-lisp (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)) #+END_SRC

    Alternatively, with posframe:

    #+BEGIN_SRC emacs-lisp (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)) #+END_SRC

    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~:

    #+BEGIN_SRC emacs-lisp (custom-set-faces '(evil-owl-group-name ((t (:inherit font-lock-function-name-face)))) '(evil-owl-entry-name ((t (:inherit font-lock-type-face))))) #+END_SRC

** 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:

#+BEGIN_SRC emacs-lisp (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") #+END_SRC

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:

#+BEGIN_SRC emacs-lisp (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") #+END_SRC

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

#+BEGIN_SRC emacs-lisp (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"      . (?\[ ?\] ?< ?> ?^ ?\( ?\) ?{ ?}))))

#+END_SRC

~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.

#+BEGIN_SRC emacs-lisp (setq evil-owl-display-method 'window) #+END_SRC

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

#+BEGIN_SRC emacs-lisp (setq evil-owl-idle-delay 1.0) #+END_SRC

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~.

#+BEGIN_SRC emacs-lisp ;; 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))

#+END_SRC

~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.

#+BEGIN_SRC emacs-lisp (setq evil-owl-max-string-length 100) #+END_SRC

  • Inspirations
    • [[https://github.com/junegunn/vim-peekaboo][vim-peekaboo]] by Junegunn Choi