mini.jump2d
Generated from the main branch of ‘mini.nvim’
Jump within visible lines via iterative label filtering
See more details in Features and Documentation.
This was previously hosted at a personal echasnovski GitHub account. It was transferred to a dedicated organization to improve long term project stability. See more details here.
⦿ This is a part of mini.nvim library. Please use this link if you want to mention this module.
⦿ All contributions (issues, pull requests, discussions, etc.) are done inside of ‘mini.nvim’.
⦿ See whole library documentation to learn about general design principles, disable/configuration recipes, and more.
⦿ See MiniMax for a full config example that uses this module.
If you want to help this project grow but don’t know where to start, check out contributing guides of ‘mini.nvim’ or leave a Github star for ‘mini.nvim’ project and/or any its standalone Git repositories.
Demo
Features
- Make jump by iterative filtering of possible, equally considered jump spots until there is only one. Filtering is done by typing a label character that is visualized at jump spot.
- Customizable:
- Way of computing possible jump spots with opinionated default.
- Characters used to label jump spots during iterative filtering.
- Visual effects: how many steps ahead to show; dim lines with spots.
- Action hooks to be executed at certain events during jump.
- Allowed windows: current and/or not current.
- Allowed lines: whether to process blank or folded lines, lines before/at/after cursor line, etc. Example: user can configure to look for spots only inside current window at or after cursor line. Example: user can configure to look for word starts only inside current window at or after cursor line with ‘j’ and ‘k’ labels performing some action after jump.
- Works in Visual and Operator-pending (with dot-repeat) modes.
- Preconfigured ways of computing jump spots (see help for
MiniJump2d.builtin_opts()):- Starts of lines.
- Starts of words.
- Single character from user input.
- Variable length query from user input.
- Works with multibyte characters.
Installation
This plugin can be installed as part of ‘mini.nvim’ library (recommended) or as a standalone Git repository.
There are two branches to install from:
main(default, recommended) will have latest development version of plugin. All changes since last stable release should be perceived as being in beta testing phase (meaning they already passed alpha-testing and are moderately settled).stablewill be updated only upon releases with code tested during public beta-testing phase inmainbranch.
Here are code snippets for some common installation methods (use only one):
With mini.deps
‘mini.nvim’ library:
Branch Code snippet Main Follow recommended ‘mini.deps’ installation Stable Follow recommended ‘mini.deps’ installation Standalone plugin:
Branch Code snippet Main add(‘nvim-mini/mini.jump2d’)Stable add({ source = ‘nvim-mini/mini.jump2d’, checkout = ‘stable’ })
With folke/lazy.nvim
‘mini.nvim’ library:
Branch Code snippet Main { 'nvim-mini/mini.nvim', version = false },Stable { 'nvim-mini/mini.nvim', version = '*' },Standalone plugin:
Branch Code snippet Main { 'nvim-mini/mini.jump2d', version = false },Stable { 'nvim-mini/mini.jump2d', version = '*' },
With junegunn/vim-plug
‘mini.nvim’ library:
Branch Code snippet Main Plug 'nvim-mini/mini.nvim'Stable Plug 'nvim-mini/mini.nvim', { 'branch': 'stable' }Standalone plugin:
Branch Code snippet Main Plug 'nvim-mini/mini.jump2d'Stable Plug 'nvim-mini/mini.jump2d', { 'branch': 'stable' }
Important: don’t forget to call require('mini.jump2d').setup() to enable its functionality.
Note: if you are on Windows, there might be problems with too long file paths (like error: unable to create file <some file name>: Filename too long). Try doing one of the following:
- Enable corresponding git global config value:
git config --system core.longpaths true. Then try to reinstall. - Install plugin in other place with shorter path.
Default config
-- No need to copy this inside `setup()`. Will be used automatically.
{
-- Function producing jump spots (byte indexed) for a particular line.
-- For more information see |MiniJump2d.start|.
-- If `nil` (default) - use |MiniJump2d.default_spotter|
spotter = nil,
-- Characters used for labels of jump spots (in supplied order)
labels = 'abcdefghijklmnopqrstuvwxyz',
-- Options for visual effects
view = {
-- Whether to dim lines with at least one jump spot
dim = false,
-- How many steps ahead to show. Set to big number to show all steps.
n_steps_ahead = 0,
},
-- Which lines are used for computing spots
allowed_lines = {
blank = true, -- Blank line (not sent to spotter even if `true`)
cursor_before = true, -- Lines before cursor line
cursor_at = true, -- Cursor line
cursor_after = true, -- Lines after cursor line
fold = true, -- Start of fold (not sent to spotter even if `true`)
},
-- Which windows from current tabpage are used for visible lines
allowed_windows = {
current = true,
not_current = true,
},
-- Functions to be executed at certain events
hooks = {
before_start = nil, -- Before jump start
after_jump = nil, -- After jump was actually done
},
-- Module mappings. Use `''` (empty string) to disable one.
mappings = {
start_jumping = '<CR>',
},
-- Whether to disable showing non-error feedback
-- This also affects (purely informational) helper messages shown after
-- idle time if user input is required.
silent = false,
}Similar plugins
- phaazon/hop.nvim (main inspiration behind this module)
- ggandor/lightspeed.nvim
- ggandor/leap.nvim
- rlane/pounce.nvim