Skip to content

Latest commit

 

History

History
150 lines (121 loc) · 6.37 KB

mini-jump2d.md

File metadata and controls

150 lines (121 loc) · 6.37 KB

GitHub license

Jump within visible lines via iterative label filtering

See more details in help file.

This is a part of mini.nvim library. See its repository page to learn about common design principles and configuration recipes.

If you want to help this project grow but don't know where to start, check out contributing guides or leave a Github star for 'mini.nvim' project.

Demo

demo-jump2d.mp4

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.
    • 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()).
  • Works with multibyte characters.

Installation

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).
  • stable will be updated only upon releases with code tested during public beta-testing phase in main branch.

Here are code snippets for some common installation methods (use only one):

Branch Code snippet
Main use 'echasnovski/mini.nvim'
Stable use { 'echasnovski/mini.nvim', branch = 'stable' }
Branch Code snippet
Main Plug 'echasnovski/mini.nvim'
Stable Plug 'echasnovski/mini.nvim', { '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',

  -- 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>',
  },
}

Similar plugins