• Stars
    star
    194
  • Rank 200,219 (Top 4 %)
  • Language
    Emacs Lisp
  • Created about 10 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

⏊ A port of vim easymotion to Emacs' evil-mode

evil-easymotion

MELPA

In which we give Lokaltog/vim-easymotion a streak of malevolence.

Suppose you're a proud user of evil, but you have a nasty habit: when you want to move ten lines down, you hit j ten times in a row instead of using the ergonomically superior 10j. With evil-easymotion you can invoke SPCj, and this plugin will put a target character on every possible position. Type the character on the target and wham! you have teleported there.

Obligatory screencast

screencast

Currently most motions are supported, and it's easy to define your own easymotions. Easymotions can also be composed with operators e.g. dSPCj to delete a bunch of lines.

Notice

The evil-easymotion API has changed to use keyword arguments. The required changes (if any) to your config should be pretty self-explanatory. This should allow me to add more options in the future without breaking your config.

Basic Usage

evil-easymotion comes with predefined easymotions for all basic motions that evil defines by default, and provides key bindings for these using the standard evil keys in the built-in keymap evilem-map. To make these available for use, bind this keymap to a prefix:

(evilem-default-keybindings "SPC")

This binds all motions under the prefix SPC in evil-motion-state-map. Type SPCj to give it a try.

For motions defined manually, you need to bind the keys yourself, for instance using evilem-define:

(evilem-define (kbd "SPC w") 'evil-forward-word-begin)

(This is just an example; this functionality is already available by default.)

You can always drop by the wiki for more tips.

Building Your Own Motions

Collectors

Where present, collectors is used as the motion specification for generating jump points. It may be an (optionally sharp) quoted function name, a lambda, or a list of any of the above. If multiple functions are provided, the collected points are merged and presented at once.

Macros

evil-easymotion provides four user-facing macros:

  • (evilem-make-motion-plain name collectors &key ...)

    Produce a function, named name, from collectors.

  • (evilem-make-motion name collectors &key ...)

    Like evilem-make-motion-plain, but produce an evil motion produced with evil-define-motion instead of a plain defun.

  • (evilem-create-plain collectors &key ...)

    Like evil-make-motion-plain, but with an automatically generated name.

  • (evilem-create collectors &key ...)

    evilem-create : evil-evilem-make-motion :: evilem-create-plain : evilem-make-motion-plain

  • (evilem-define key collectors)

    Like evilem-create, but also bind the generated function to key in the relevant maps (either evil-normal-state or evil-motion-state, depending on other flags).

Keyword arguments

In addition, various keyword arguments may be used to modify the behavior of the easymotion.

  • :pre-hook expr

    Code to run before the easymotion executes. expr may either be an (optionally sharp) quoted function name, a lambda, or a bare sexp, which is implictly wrapped in a lambda.

  • :post-hook expr

    Like :pre-hook expr, but code is run after the motion finishes.

  • :bind forms

    A list of forms to bind around the entire easymotion. forms may be any bindings accepted by cl-letf*.

  • :scope object

    An object to limit the scope of an easymotion. object may be any thing understood by thing-at-point. In practice, object will often be 'line.

  • :all-windows expr

    If expr is non-nil, the motion will be executed in all visible windows simultaneously. Because evil motions do not make sense across windows, evil-define-command is used instead of evil-define-motion and evil-normal-state-map is used instead of evil-motion-state-map.

  • :initial-position callable

    When specified, (goto-char (funcall callable)) is run before the motion is executed. For example, use this to jump to the BOL of each line as in easymotion with :initial-position #'point-at-bol. Unlike in :pre-hook, callable is run once per window when :all-windows is specified.

  • :push-jump expr

    When expr is non-nil, the motion will push to the evil jump list before jumping. This defaults to t when the motion is un:scopeed.

  • :collect-postprocess callable

    When specified, callable is called on the collected list of points (which is of the form ((point window)...)). Otherwise, the default function, which sorts the points in order of increasing distance from (point), is used.

  • :include-invisible expr

    When expr is non-nil, the motion will not skip over invisible overlays. This may be required for motions that generate dramatically different sets of points if they are started at different locations. This defaults to nil.

Credits

I'm deeply indebted to:

More Repositories

1

quark-emacs

🚀 An incredible wonderland of code
Emacs Lisp
133
star
2

company-flx

🌆 Flx fuzzy matching for company
Emacs Lisp
85
star
3

helm-flx

🔀 Flx-based fuzzy sorting for helm
Emacs Lisp
48
star
4

historian.el

📚 Persistently store selected minibuffer candidates
Emacs Lisp
31
star
5

flx-isearch

🔍 Fuzzy incremental searching for emacs
Emacs Lisp
27
star
6

su.el

Automatically read and write files using su or sudo
Emacs Lisp
17
star
7

resilio-sync-cli

Reversed engineered API wrapper and CLI for Resilio Sync
Python
12
star
8

zsh-config

🔧 My personal ZSH config
Shell
7
star
9

alphazero-othello

An implementation of the AlphaZero algorithm for playing Othello (aka. Reversi)
TeX
5
star
10

sage-config

đŸ”Ŗ My SAGEmath configuration
Sage
3
star
11

facebook_messages_parser.py

ℹī¸ A simple parser for exploring downloaded Facebook Messenger transcripts
Python
3
star
12

virtualbox-remote-snapshots

🕓 A snapshot system for VirtualBox which supports remote storage
PowerShell
3
star
13

apptainer-jax

Apptainer "kitchen sink" ML environment using Poetry
Shell
2
star
14

omnomnom

🎮 Pacman, but played with your face! - 5C Hackathon 2017
C++
2
star
15

dfa_learning

Learning DFAs
Julia
2
star
16

japanese_translation_assistant

📖 Program to parse Japanese sentences and give English definitions
Python
2
star
17

cryptomissive

📧 A simple encrypted HTML wrapper
HTML
2
star
18

quark-zsh

Next generation zsh config
Shell
2
star
19

linear-presentation

Program to compute the "linear presentation" of a knot
Python
2
star
20

libre.css

đŸ’Ŧ My libre theme for AoPS blogs
CSS
1
star
21

bdprochotctl

A small linux script to control BD PROCHOT
Python
1
star
22

photo-deblur

Experiments in unblurring photographs
Python
1
star
23

cse599d1-final-project

Adversarial attacks against Neural Tangent Kernels
Python
1
star
24

julia-cas

✖ī¸ This is a toy cas written in julia
Julia
1
star
25

Everything-Dojo

Everything Dojo
PHP
1
star
26

hw-photo-enhance

An ugly script to make typed documents with textbook photos look less ugly
Python
1
star
27

puzzle.py

Various utilities to help with puzzle solving — will dogfood aggressively
Python
1
star
28

dotfiles

🔨 Assorted dotfiles not significant enough to deserve their own repo
Python
1
star
29

math173-fa18-notes

Notes for MATH 173: Advanced Linear Algebra, Fall 2018
TeX
1
star
30

zsh-minimal

💀 [deprecated] A zsh config for machines without much oomph. (e.g. Raspberry Pi's)
Shell
1
star
31

latex-scratchpad

A real-time LaTeX scratchpad for the web
JavaScript
1
star
32

diffgeo-edge-detector

Edge detection in scale space
TeX
1
star
33

realtime-latex-messenger

🌟 A realtime LaTeX messenger - 5C Hackathon 2016
JavaScript
1
star