Skip to content

Commit 8aed9cf

Browse files
committed
Add flash.nvim for label-based fast motion
Bundle flash.nvim in the general.always plugin set and load it after UI startup. Map s/S/r/R for jump, treesitter, and remote motions, and enable char mode so f/t/F/T/;/, work across lines. Visual-mode S and plain / search are left untouched (surround and default search).
1 parent 36f7b25 commit 8aed9cf

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@
178178
nvim-surround
179179
nvim-spectre
180180
nvim-autopairs
181+
flash-nvim
181182
];
182183
extra = with pkgs.vimPlugins; [
183184
fidget-nvim

lua/myLuaConf/plugins/init.lua

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,42 @@ require('lze').load {
250250
require('nvim-surround').setup()
251251
end,
252252
},
253+
{
254+
"flash.nvim",
255+
for_cat = 'general.always',
256+
-- Load eagerly (after UI) so the f/t/F/T enhancements are live everywhere,
257+
-- not just after the first jump. flash.setup() does NOT create keymaps, so
258+
-- we define them ourselves below.
259+
event = "DeferredUIEnter",
260+
after = function(_)
261+
local flash = require('flash')
262+
flash.setup({
263+
modes = {
264+
-- Enhance f/t/F/T and ;/, to jump across lines and stay repeatable.
265+
char = { enabled = true },
266+
-- Leave a plain `/` search untouched; opt into labels via <C-s> below.
267+
search = { enabled = false },
268+
},
269+
})
270+
271+
-- Vimium-style jump: trigger, type 1-2 chars of the target, press a label.
272+
vim.keymap.set({ 'n', 'x', 'o' }, 's', function() flash.jump() end,
273+
{ desc = 'Flash jump' })
274+
-- Treesitter node jump/select. Normal + operator-pending only; visual `S`
275+
-- stays bound to nvim-surround.
276+
vim.keymap.set({ 'n', 'o' }, 'S', function() flash.treesitter() end,
277+
{ desc = 'Flash Treesitter' })
278+
-- Operator-pending remote jump, e.g. `yr` + label to yank from elsewhere.
279+
vim.keymap.set('o', 'r', function() flash.remote() end,
280+
{ desc = 'Flash remote' })
281+
-- Extend/refine a Treesitter search selection.
282+
vim.keymap.set({ 'o', 'x' }, 'R', function() flash.treesitter_search() end,
283+
{ desc = 'Flash Treesitter search' })
284+
-- Toggle Flash labels while typing a normal `/` search.
285+
vim.keymap.set('c', '<C-s>', function() flash.toggle() end,
286+
{ desc = 'Toggle Flash search' })
287+
end,
288+
},
253289
{
254290
"vim-startuptime",
255291
for_cat = 'general.extra',

0 commit comments

Comments
 (0)