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
reusesevil
’s runner function for replacement and match previews
- vglobal
- yank
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))
To view all available faces and options, see M-x customize-group
[RET] evil-traces [RET]
.
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
.
The idle update delay is controlled by evil-traces-idle-delay
.
(setq evil-traces-idle-delay 0.05)
Warnings and information can be enabled or disabled through
evil-traces-enable-echo
.
(setq evil-traces-enable-echo t)
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-traces-deftype
.
:delete
:global
:join
:move