vimtricks.wiki Concise Vim tricks, one at a time.

How do I jump anywhere on screen with labeled targets using flash.nvim?

Answer

:lua require('flash').jump()

Explanation

flash.nvim by folke is a Neovim plugin that overlays short, unique jump labels on every visible match so you can teleport the cursor anywhere on screen in two or three keystrokes. It enhances and replaces f/F/t/T motions and also provides treesitter-aware selection and remote operator support.

How it works

Flash integrates with Neovim's search infrastructure. After pressing the trigger key (s by default), you type one or two characters. Flash highlights all matches on screen with a single-letter label. Type the label to jump.

Default mappings (set during require('flash').setup()):

  • s — jump to any position on screen (replaces vim-sneak-style s)
  • S — treesitter-aware jump that also selects the target node visually
  • r (in operator-pending mode) — remote flash: apply any operator to a distant target without moving the cursor first

Example setup:

require('flash').setup({
  modes = {
    search = { enabled = true },   -- enhance / with flash labels
    char   = { enabled = true },   -- enhance f/F/t/T
  },
})

Example

You want to delete a word three lines above without leaving your current position:

  1. Press d (delete operator)
  2. Press r (remote flash in operator-pending mode)
  3. Type the first letter of the target word — flash shows labels
  4. Type the label — the word is deleted and the cursor returns

This is equivalent to jumping up, performing the operation, then jumping back — but in one fluid motion.

Tips

  • Enhanced /: with modes.search = { enabled = true }, flash adds labels to incremental search results, letting you jump to any match instantly instead of repeatedly pressing n
  • Treesitter select (S): jumps to the nearest node of a selected treesitter type — ideal for selecting function arguments, blocks, or statements precisely
  • Repeat jumps: use ; and , to repeat the last flash jump forward and backward
  • Flash labels are case-sensitive uppercase letters by default, minimizing conflicts with typed characters
  • Works with count: 3s limits flash to the first 3 matches

Next

How do I show both the absolute line number on the current line and relative numbers on all other lines?