• Stars
    star
    2,121
  • Rank 21,756 (Top 0.5 %)
  • Language
    Lua
  • License
    Other
  • Created almost 4 years ago
  • Updated over 1 year ago

Reviews

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

Repository Details

Neovim motions on speed!
                                          __
                                         / /_  ____  ____
                                        / __ \/ __ \/ __ \
                                       / / / / /_/ / /_/ /
                                      /_/ /_/\____/ .___/
                                                 /_/
                                  · Neovim motions on speed! ·

Install · Wiki · Screenshots · Discuss

Hop is an EasyMotion-like plugin allowing you to jump anywhere in a document with as few keystrokes as possible. It does so by annotating text in your buffer with hints, short string sequences for which each character represents a key to type to jump to the annotated text. Most of the time, those sequences’ lengths will be between 1 to 3 characters, making every jump target in your document reachable in a few keystrokes.

Motivation

Hop is a complete from-scratch rewrite of EasyMotion, a famous plugin to enhance the native motions of Vim. Even though EasyMotion is usable in Neovim, it suffers from a few drawbacks making it not comfortable to use with Neovim version >0.5 – at least at the time of writing these lines:

  • EasyMotion uses an old trick to annotate jump targets by saving the contents of the buffer, replacing it with the highlighted annotations and then restoring the initial buffer after jump. This trick is dangerous as it will change the contents of your buffer. A UI plugin should never do anything to existing buffers’ contents.
  • Because the contents of buffers will temporarily change, other parts of the editor and/or plugins relying on buffer change events will react and will go mad. An example is the internal LSP client implementation of Neovim >0.5 or its treesitter native implementation. For LSP, it means that the connected LSP server will receive a buffer with the jump target annotations… not ideal.

Hop is a modern take implementing this concept for the latest versions of Neovim.

Features

  • Go to any word in the current buffer (:HopWord).
  • Go to any character in the current buffer (:HopChar1).
  • Go to any bigrams in the current buffer (:HopChar2).
  • Make an arbitrary search akin to / and go to any occurrences (:HopPattern).
  • Go to any line and any line start (:HopLine, :HopLineStart).
  • Go to anywhere (:HopAnywhere).
  • Use Hop cross windows with multi-windows support (:Hop*MW).
  • Use it with commands like v, d, c, y to visually select/delete/change/yank up to your new cursor position.
  • Support a wide variety of user configuration options, among the possibility to alter the behavior of commands to hint only before or after the cursor (:Hop*BC, :Hop*AC), for the current line (:Hop*CurrentLine), change the dictionary keys to use for the labels, jump on sole occurrence, etc.
  • Extensible: provide your own jump targets and create Hop extensions!

Getting started

This section will guide you through the list of steps you must take to be able to get started with Hop.

This plugin was written against Neovim 0.5, which is currently a nightly version. This plugin will not work:

  • With a version of Neovim before 0.5.
  • On Vim. No support for Vim is planned.

Installation

Whatever solution / package manager you are using, you need to ensure that the setup Lua function is called at some point, otherwise the plugin will not work. If your package manager doesn’t support automatic calling of this function, you can call it manually after your plugin is installed:

require'hop'.setup()

To get a default experience. Feel free to customize later the setup invocation (:h hop.setup). If you do, then you will probably want to ensure the configuration is okay by running :checkhealth. Various checks will be performed by Hop to ensure everything is all good.

Important note about versioning

This plugin implements SemVer via git branches and tags. Versions are prefixed with a v, and only patch versions are git tags. Major and minor versions are git branches. You are very strongly advised to use a major version dependency to be sure your config will not break when Hop gets updated.

Using vim-plug

Plug 'phaazon/hop.nvim'

Using packer

use {
  'phaazon/hop.nvim',
  branch = 'v2', -- optional but strongly recommended
  config = function()
    -- you can configure Hop the way you like here; see :h hop-config
    require'hop'.setup { keys = 'etovxqpdygfblzhckisuran' }
  end
}

Nightly users

Hop supports nightly releases of Neovim. However, keep in mind that if you are on a nightly version, you must be on the last one. If you are not, then you are exposed to compatibility issues / breakage.

Usage

See the wiki.

Keybindings

Hop doesn’t set any keybindings; you will have to define them by yourself.

If you want to create a key binding from within Lua:

-- place this in one of your configuration file(s)
local hop = require('hop')
local directions = require('hop.hint').HintDirection
vim.keymap.set('', 'f', function()
  hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = true })
end, {remap=true})
vim.keymap.set('', 'F', function()
  hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = true })
end, {remap=true})
vim.keymap.set('', 't', function()
  hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = true, hint_offset = -1 })
end, {remap=true})
vim.keymap.set('', 'T', function()
  hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = true, hint_offset = 1 })
end, {remap=true})

Chat

Join the discussion on the official Matrix room!

More Repositories

1

luminance-rs

Type-safe, type-level and stateless Rust graphics framework
Rust
1,073
star
2

mind.nvim

The power of trees at your fingertips.
Lua
704
star
3

this-week-in-neovim-contents

Contents of weekly news delivered by this-week-in-neovim.org.
261
star
4

warmy

Hot-reloading loadable and reloadable resources
Rust
210
star
5

this-week-in-neovim.org

this-week-in-neovim.org official webapp repository
Rust
183
star
6

glsl

GLSL parser for Rust
Rust
180
star
7

splines

Interpolation made easy.
Rust
131
star
8

spectra

Rust demoscene engine (currently on hold)
Rust
124
star
9

luminance

Type-safe, type-level and stateless Haskell graphics framework
Haskell
110
star
10

shades

Rust EDSL for shading languages
Rust
66
star
11

config

My main configuration files
Lua
65
star
12

cargo-sync-readme

Generate a Markdown section in your README based on your Rust documentation
Rust
55
star
13

toodoux

A task manager based on taskwarrior
Rust
51
star
14

mind

The power of trees at your fingertips
Rust
42
star
15

notisys.nvim

System-wide notifications for Neovim
Lua
40
star
16

do-notation

The Haskell’s do notation brought to Rust
Rust
39
star
17

cheddar

The Cheddar GLSL superset language
Rust
27
star
18

spline-editor

A simple spline editor for the splines crate
Rust
24
star
19

wavefront

Haskell Wavefront OBJ loader library
Haskell
19
star
20

bidule

Very simple and Rust FRP crate
Rust
18
star
21

poesie.nvim

Lua
16
star
22

stack-haddock-upload

A little script to upload documentation to Hackage within a stack-powered project
Shell
14
star
23

learn-luminance

11
star
24

luminance-gl-rs

DEPRECATED luminance-gl has been moved into https://github.com/phaazon/luminance-rs
Rust
11
star
25

celeri-remoulade

The Undead Sceners PC demo for Evoke 2016
Rust
10
star
26

smoothie

Smooth curves via several interpolation modes
Haskell
10
star
27

advent-of-code-2k18

https://adventofcode.com/2018
Rust
9
star
28

phaazon.net

Source code of phaazon.net.
Rust
8
star
29

kak-tree-sitter

tree-sitter meets Kakoune
Rust
8
star
30

try-guard

A guard! macro inspired by the guard Alternative function from Haskell.
Rust
6
star
31

luminance-samples

Luminance samples
Haskell
6
star
32

monad-journal

Pure logger typeclass and monad transformer
Haskell
6
star
33

outline-2017-invitro

Outline 2017 Invitation, by DESiRE and The Undead Sceners (code by @phaazon)
Rust
6
star
34

quaazar

Realtime 3D engine
Haskell
6
star
35

pixels-of-life

A GPU accelerated version of Conway’s Game of Life
Rust
5
star
36

save-z0r

Because those loops are too epic to let them go!
Rust
5
star
37

hsFModEx

FModEx Haskell API. Discontinued.
Haskell
4
star
38

hid

Haskell interface to hidapi
Haskell
4
star
39

any-cache

Cache with any key and any associated value
Rust
4
star
40

zero

Semigroups with absorbing element
Haskell
4
star
41

lightning-road-to-liquid-radiator

Official source code of Lightning Road To Liquid Radiator
C++
4
star
42

lqducul

Rust
4
star
43

cheddar-edit

A shader-toy-like project that aims to shader rapid prototyping
Rust
4
star
44

msi-kb-backlit

A command line tool to change backlit colors of your MSI keyboard
Haskell
3
star
45

reactant

FRP Haskell library
Haskell
3
star
46

non-empty

Efficient non-empty vectors in Rust
Rust
3
star
47

al

Haskell OpenAL raw binding
Haskell
3
star
48

glsl-quasiquote

The glsl! procedural macro for the glsl crate.
3
star
49

awoo

Rust
3
star
50

html-entities

Rust html entities utility functions
Rust
2
star
51

brainfarts

Pets de cerveaux.
2
star
52

kwak

The (in)famous bot you all love on IRC! (see her in action in #demofr@freenode)
Rust
2
star
53

luminance-windowing

Common windowing code for luminance (not an actual backend)
2
star
54

event

Monoidal, monadic and first-class events.
Haskell
2
star
55

par-soeur

Run away, nothing to see here!
Rust
2
star
56

advent-of-code-2021

https://adventofcode.com/
Rust
2
star
57

luminance-glutin

glutin support for luminance
Rust
2
star
58

proc-macro-faithful-display

A more faithful Display for proc-macro token types.
Rust
2
star
59

thunk

Some research project of mine about sharing thunks in Rust
Rust
2
star
60

tellbot

IRC bot with account simple tasks and tells function
Haskell
2
star
61

inject-function

Haskell package that lets you write regular functions with the extra feature to be able to inject parameters that can be shared over function composition
Haskell
2
star
62

leaf

A simple portfolio generator
Haskell
2
star
63

rust-gl-toy

As I’m learning rust, let’s play with OpenGL and GLFW here ;)
Rust
1
star
64

igl

Indexed OpenGL; a safer OpenGL implementation
Haskell
1
star
65

algo

Some famous algorithms, written with fun
Rust
1
star
66

conal_frp

An experiment at implementing FRP as described by its father, Conal Elliott. Paper here http://conal.net/papers/push-pull-frp/push-pull-frp.pdf
Haskell
1
star
67

heat-station

Official source code of Heat Station
C++
1
star
68

chronos

Simple FRP timeline. Designed to be used for demoscene purposes
Haskell
1
star
69

luminance-glfw

GLFW support for luminance
1
star
70

skp

skp D framework
D
1
star
71

advent-of-code-2020

Haskell
1
star
72

gltf

Haskell GLTF loader
Haskell
1
star
73

aur

All packages I maintain in AUR
Shell
1
star
74

codingame-unleash-the-geek

My contribution to Unleash The Geek (started on 7th of October 2019)
Rust
1
star
75

meta

Demoscene framework
Perl
1
star
76

fractalis

A Mandelbrot fractal viewer
C
1
star
77

leetify

Leetify some text!
Haskell
1
star
78

agui

Abstract GUI
Haskell
1
star
79

impersonate

An experimental Markov chain generator that learns how to speak as if it was someone else.
Rust
1
star
80

sdffont

A tool that generates signed distance fields fontmap from font file (.ttf, and so on).
Haskell
1
star
81

hush

Demoscene soft synthesizer designed to be embedded in intros.
Rust
1
star
82

iutbx1-ds

IUT Bordeaux 1 Dimitri Sabadie official repository
C++
1
star
83

atoi-data-dependency

A short and fun study of data dependency and compiler optimizations
Rust
1
star
84

rcpp

A Rust implementation of the C Preprocessor
Rust
1
star
85

colorscheme-gen

A little tool to generate color scheme for urxvt session and using the Text Export option of the colorscheme web site.
Shell
1
star
86

phraskell

Fractal set viewer.
Haskell
1
star
87

blog

phaazon.net blog articles
1
star
88

advent-of-code-2022

Advent of Code 2022 solutions
Rust
1
star