Skip to content
 
 

Latest commit

 

History

33 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The smallest sensible Neovim jump plugin in the west

nvim-jump is a jump plugin similar to pounce and flash, but with a severely reduced feature set and as a result a tiny fraction of the code (less than 200 lines of code).

Usage is simple: press a key to trigger the plugin, type one or more characters to reduce the number of matches, then press the label to jump to it. Basically it's like the / operator but with the ability to easily jump to a specific match instead of having to hit n a bunch of times:

Demo

Compared to other plugins this allows for jumping that's just as fast but without the mental cost of having to deal with changing labels, a hundred labels displayed on screen, and so on.

Why?

I've used various jump plugins in the past, but the experience has been mixed. In terms of features and stability pounce was the best, but it only supports upper case labels which makes jumping more annoying.

Flash is more powerful but in my experience Folke's plugins tend to be janky (e.g. weird/buggy behavior), issues just get closed automatically with no response and maintenance is spotty.

mini.jump2d is a good jump plugin but I don't like its approach to labelling and jumping as it results in a very noisy window full of labels. Like most mini.nvim plugins you can extend it (and this is something I experimented with a lot), but there's only so far this will get you.

leap and others try really hard to be clever about jumping around but in the end I found using them to be deeply confusing.

This plugin has existed in my own dotfiles repository for a while, and I now deem it stable enough to share it as a standalone plugin.

Features

  • Jump to arbitrary text similar to / but without having to press n a bunch of times
  • Labels that remain consistent (as much as possible) as you type more input
  • Reduce/correct input by pressing backspace
  • Case-insensitive if the input is lower case, case-sensitive if it includes capitals
  • Small codebase so less likely to be riddled with bugs

Feature-wise this plugin is considered complete and extra features (e.g. jumping between windows) won't be added.

Requirements

  • Neovim 0.11.0 or newer, earlier versions might also work but aren't supported

Usage

Install the plugin using your favorite plugin manager, then create a mapping (this maps the plugin to the s key):

vim.keymap.set({ 'n', 'x', 'o' }, 's', function()
  require('jump').start()
end, {})

If you want to change the labels to use or the highlight groups, use the setup function:

require('jump').setup({
  labels = 'abcdef'
})

The following settings are available (along with their defaults):

{
  -- The labels that may be used, in order of their preference.
  labels = 'fdsaghjklrewqtyuiopvcxzbnm',

  -- The highlight group to use for match highlights.
  search = 'FlashMatch',

  -- The highlight group to use for labels.
  label = 'FlashLabel',

  -- The highlight group to use for the backdrop.
  backdrop = 'FlashBackdrop',

  -- Temporarily set conceallevel to 0 while searching so concealed characters
  -- are visible and labels line up with what's on screen.
  disable_conceal = true,
}

The default highlight group match flash so migrating is easier.

License

All source code in this repository is licensed under the Mozilla Public License version 2.0, unless stated otherwise. A copy of this license can be found in the file "LICENSE".

About

The smallest sensible Neovim jump plugin in the west

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages