How do I jump to any visible text on screen with a two-character search using flash.nvim in Neovim?
Answer
flash.nvim
Explanation
flash.nvim by folke is a motion plugin that supercharges navigation by highlighting all matches for characters you type and letting you jump directly to any of them with a single label keystroke. It integrates tightly with Neovim's search, Treesitter, and operator-pending mode.
How it works
Install with lazy.nvim and set up default keymaps:
{
'folke/flash.nvim',
event = 'VeryLazy',
keys = {
{ 's', function() require('flash').jump() end, mode = { 'n', 'x', 'o' } },
{ 'S', function() require('flash').treesitter() end, mode = { 'n', 'x', 'o' } },
{ 'r', function() require('flash').remote() end, mode = 'o' },
{ '<C-s>', function() require('flash').toggle() end, mode = { 'c' } },
},
}
Key modes:
s— type characters to highlight all matches, then press a label to jumpS— select a Treesitter node visually by jumping to itr(operator-pending) — perform an operation on a remote match, e.g.,yr<label>yanks text anywhere on screen<C-s>— toggle flash while typing a/search pattern
Example
To yank the word config visible elsewhere on screen without moving the cursor:
Press: yr, then type the first letters of 'config'
Flash highlights matches and shows labels → press the label → yanks 'config'
Tips
ds{label}deletes remote text using the operator-pending remote mode- flash.nvim replaces both vim-sneak and leap.nvim for most workflows
- Set
opts.search.multi_window = trueto jump across all visible windows - Treesitter mode (
S) is ideal for selecting function bodies or blocks without typing motion commands