vim-illuminate jump explanation

This commit is contained in:
Christoph J. Scherr 2024-07-08 11:12:31 +02:00
parent 80e3241a66
commit ed0bd3cc06
1 changed files with 12 additions and 0 deletions

View File

@ -273,6 +273,17 @@ return {
'neo-tree', 'neo-tree',
}, },
}, },
-- looks weird but is useful: put your cursor on a word and other occurences
-- of the word in your buffer will be highlighted. You can then use
-- '[[' and ']]' to go to the next or previous occurence.
--
-- Try it:
--
-- word #### word ###########
-- ############## word ######
-- #### word #### word word #
--
-- (It might not work with comments)
keys = { keys = {
{ ']]', desc = 'Next Reference' }, { ']]', desc = 'Next Reference' },
{ '[[', desc = 'Prev Reference' }, { '[[', desc = 'Prev Reference' },
@ -280,6 +291,7 @@ return {
config = function(_, opts) config = function(_, opts)
require('illuminate').configure(opts) require('illuminate').configure(opts)
-- only magic follows
local function map(key, dir, buffer) local function map(key, dir, buffer)
vim.keymap.set('n', key, function() vim.keymap.set('n', key, function()
require('illuminate')['goto_' .. dir .. '_reference'](false) require('illuminate')['goto_' .. dir .. '_reference'](false)