Skip to content

Commit d6387f9

Browse files
authored
Add vim-illuminate to highlight cursor word (#466)
1 parent e8f9552 commit d6387f9

3 files changed

Lines changed: 8 additions & 20 deletions

File tree

lua/config/lsp.lua

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -86,26 +86,6 @@ vim.api.nvim_create_autocmd("LspAttach", {
8686
-- Uncomment code below to enable inlay hint from language server, some LSP server supports inlay hint,
8787
-- but disable this feature by default, so you may need to enable inlay hint in the LSP server config.
8888
-- vim.lsp.inlay_hint.enable(true, {buffer=bufnr})
89-
90-
-- The blow command will highlight the current variable and its usages in the buffer.
91-
if client.server_capabilities.documentHighlightProvider then
92-
local gid = vim.api.nvim_create_augroup("lsp_document_highlight", { clear = true })
93-
vim.api.nvim_create_autocmd("CursorHold", {
94-
group = gid,
95-
buffer = bufnr,
96-
callback = function()
97-
vim.lsp.buf.document_highlight()
98-
end,
99-
})
100-
101-
vim.api.nvim_create_autocmd("CursorMoved", {
102-
group = gid,
103-
buffer = bufnr,
104-
callback = function()
105-
vim.lsp.buf.clear_references()
106-
end,
107-
})
108-
end
10989
end,
11090
nested = true,
11191
desc = "Configure buffer keymap and behavior based on LSP",

lua/custom-autocmd.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ api.nvim_create_autocmd("ColorScheme", {
187187

188188
-- highlight for matching parentheses
189189
vim.api.nvim_set_hl(0, "MatchParen", { bold = true, underline = true })
190+
191+
vim.api.nvim_set_hl(0, "IlluminatedWordWrite", { underline = true, reverse = true })
192+
vim.api.nvim_set_hl(0, "IlluminatedWordRead", { underline = true, reverse = true })
193+
vim.api.nvim_set_hl(0, "IlluminatedWordText", { underline = true, reverse = true })
190194
end,
191195
})
192196

lua/plugin_specs.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,10 @@ local plugin_specs = {
759759
vim.o.autoread = true
760760
end,
761761
},
762+
{
763+
"RRethy/vim-illuminate",
764+
event = "VeryLazy",
765+
},
762766
}
763767

764768
require("lazy").setup {

0 commit comments

Comments
 (0)