Skip to content
some evil-ex command previews
Emacs Lisp Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
img Update README Jul 13, 2019
test
.gitignore Add tests Jul 11, 2019
.travis.yml Add tests Jul 11, 2019
LICENSE initial commit Jul 3, 2019
Makefile Add tests Jul 11, 2019
README.org
evil-traces.el Add evil-traces-use-diff-refine-faces Aug 18, 2019

README.org

Evil Traces

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

evil-traces is a port of traces.vim. It enables visual previews for certain evil-ex commands.

Currently, these commands are:

  • change
  • copy
  • delete
  • global
  • join
  • move
  • normal
  • shell command
  • sort
  • substitute
    • evil-traces reuses evil’s runner function for replacement and match previews
  • vglobal
  • yank

Basic Example

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

(use-package evil-traces
  :config
  (evil-traces-use-diff-faces) ; if you want to use diff's faces
  (evil-traces-mode))

Customization

To view all available faces and options, see M-x customize-group [RET] evil-traces [RET].

Faces

evil-traces uses the following faces:

  • evil-traces-default
  • evil-traces-change
  • evil-traces-copy-preview
  • evil-traces-copy-range
  • evil-traces-delete
  • evil-traces-global-match
  • evil-traces-global-range
  • evil-traces-join-indicator
  • evil-traces-join-range
  • evil-traces-move-preview
  • evil-traces-move-range
  • evil-traces-normal
  • evil-traces-shell-command
  • evil-traces-sort
  • evil-traces-substitute-range
  • evil-traces-yank

By default, most faces inherit from evil-traces-default, which inherits from region. You may use custom-set-faces to edit face values:

(custom-set-faces
 '(evil-traces-join-indicator ((t (:inherit diff-added))))
 '(evil-traces-join-range     ((t (:inherit diff-changed))))
 ;; etc.
 )

Alternatively, you can set the faces with evil-traces-use-diff-faces or evil-traces-use-diff-refine-faces.

Variables

The idle update delay is controlled by evil-traces-idle-delay.

(setq evil-traces-idle-delay 0.05)

Visual previews can be suspended through evil-traces-suspend-function. evil-traces-suspend-function takes no arguments and returns non-nil when previews should not be shown.

(defun my-evil-traces-suspend-p ()
  "Return non-nil if both `evil-ex-range' and `evil-ex-argument' are nil."
  (and (null evil-ex-range) (null evil-ex-argument)))

;; Only show previews if a range or argument has been typed.
(setq evil-traces-suspend-function #'my-evil-traces-suspend-p)

evil-traces-join-indicator and evil-traces-join-indicator-padding control the appearance of :join’s end-of-line indicators.

(setq evil-traces-join-indicator "<<<"
      evil-traces-join-indicator-padding 2)

evil-traces-argument-type-alist determines what argument type each ex command gets mapped to when evil-traces-mode is on. evil uses the argument type to determine which highlighting function to use, so this variable can be modified to change highlighting behavior. For example,

;; Enable :change when lispyville-mode is on
(add-to-list 'evil-traces-argument-type-alist '(lispyville-change . evil-traces-change))

;; You can use :delete's preview for :move if :move's annoys you.
(add-to-list 'evil-traces-argument-type-alist '(evil-move . evil-traces-delete))

If you want to add your own argument type, take a look at evil-ex-define-argument-type and its :runner keyword.

Sample GIFs

:delete

./img/delete.gif

:global

./img/global.gif

:join

./img/join.gif

:move

./img/move.gif

Inspirations

You can’t perform that action at this time.