@@ -546,35 +546,6 @@ require('lazy').setup({
546546 -- For example, in C this would take you to the header.
547547 map (' gD' , vim .lsp .buf .declaration , ' [G]oto [D]eclaration' )
548548
549- -- The following two autocommands are used to highlight references of the
550- -- word under your cursor when your cursor rests there for a little while.
551- -- See `:help CursorHold` for information about when this is executed
552- --
553- -- When you move your cursor, the highlights will be cleared (the second autocommand).
554- local client = vim .lsp .get_client_by_id (event .data .client_id )
555- if client and client .supports_method (vim .lsp .protocol .Methods .textDocument_documentHighlight ) then
556- local highlight_augroup = vim .api .nvim_create_augroup (' kickstart-lsp-highlight' , { clear = false })
557- vim .api .nvim_create_autocmd ({ ' CursorHold' , ' CursorHoldI' }, {
558- buffer = event .buf ,
559- group = highlight_augroup ,
560- callback = vim .lsp .buf .document_highlight ,
561- })
562-
563- vim .api .nvim_create_autocmd ({ ' CursorMoved' , ' CursorMovedI' }, {
564- buffer = event .buf ,
565- group = highlight_augroup ,
566- callback = vim .lsp .buf .clear_references ,
567- })
568-
569- vim .api .nvim_create_autocmd (' LspDetach' , {
570- group = vim .api .nvim_create_augroup (' kickstart-lsp-detach' , { clear = true }),
571- callback = function (event2 )
572- vim .lsp .buf .clear_references ()
573- vim .api .nvim_clear_autocmds { group = ' kickstart-lsp-highlight' , buffer = event2 .buf }
574- end ,
575- })
576- end
577-
578549 -- The following code creates a keymap to toggle inlay hints in your
579550 -- code, if the language server you are using supports them
580551 --
@@ -674,6 +645,67 @@ require('lazy').setup({
674645 end ,
675646 },
676647
648+ { -- highlight references of the word under cursor
649+ ' RRethy/vim-illuminate' ,
650+ opts = {},
651+ config = function ()
652+ require (' illuminate' ).configure {
653+ -- providers: provider used to get references in the buffer, ordered by priority
654+ providers = {
655+ ' lsp' ,
656+ ' treesitter' ,
657+ ' regex' ,
658+ },
659+ -- delay: delay in milliseconds
660+ delay = 100 ,
661+ -- filetype_overrides: filetype specific overrides.
662+ -- The keys are strings to represent the filetype while the values are tables that
663+ -- supports the same keys passed to .configure except for filetypes_denylist and filetypes_allowlist
664+ filetype_overrides = {},
665+ -- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist
666+ filetypes_denylist = {
667+ ' dirbuf' ,
668+ ' dirvish' ,
669+ ' fugitive' ,
670+ },
671+ -- filetypes_allowlist: filetypes to illuminate, this is overridden by filetypes_denylist
672+ -- You must set filetypes_denylist = {} to override the defaults to allow filetypes_allowlist to take effect
673+ filetypes_allowlist = {},
674+ -- modes_denylist: modes to not illuminate, this overrides modes_allowlist
675+ -- See `:help mode()` for possible values
676+ modes_denylist = {},
677+ -- modes_allowlist: modes to illuminate, this is overridden by modes_denylist
678+ -- See `:help mode()` for possible values
679+ modes_allowlist = {},
680+ -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist
681+ -- Only applies to the 'regex' provider
682+ -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
683+ providers_regex_syntax_denylist = {},
684+ -- providers_regex_syntax_allowlist: syntax to illuminate, this is overridden by providers_regex_syntax_denylist
685+ -- Only applies to the 'regex' provider
686+ -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
687+ providers_regex_syntax_allowlist = {},
688+ -- under_cursor: whether or not to illuminate under the cursor
689+ under_cursor = true ,
690+ -- large_file_cutoff: number of lines at which to use large_file_config
691+ -- The `under_cursor` option is disabled when this cutoff is hit
692+ large_file_cutoff = nil ,
693+ -- large_file_config: config to use for large files (based on large_file_cutoff).
694+ -- Supports the same keys passed to .configure
695+ -- If nil, vim-illuminate will be disabled for large files.
696+ large_file_overrides = nil ,
697+ -- min_count_to_highlight: minimum number of matches required to perform highlighting
698+ min_count_to_highlight = 1 ,
699+ -- should_enable: a callback that overrides all other settings to
700+ -- enable/disable illumination. This will be called a lot so don't do
701+ -- anything expensive in it.
702+ should_enable = function (bufnr ) return true end ,
703+ -- case_insensitive_regex: sets regex case sensitivity
704+ case_insensitive_regex = false ,
705+ }
706+ end ,
707+ },
708+
677709 { -- Autoformat
678710 ' stevearc/conform.nvim' ,
679711 event = { ' BufWritePre' },
0 commit comments