Skip to content

Commit 0da810f

Browse files
committed
feat(plugins): replace local-highlight with mini.cursorword
Saw this [reddit comment](https://www.reddit.com/r/neovim/comments/1ix6g5f/comment/meo89tl/) and realized we don't rlly need all the extra features (esp. after a recent config break). Keeping it simple™ lol Signed-off-by: Jint-lzxy <[email protected]>
1 parent b0d8b4d commit 0da810f

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
return function()
2+
require("mini.cursorword").setup({
3+
-- Delay (in ms) between when cursor moved and when highlighting appeared
4+
delay = 200,
5+
})
6+
require("modules.utils").gen_cursorword_hl()
7+
end

lua/modules/configs/editor/local-highlight.lua

-9
This file was deleted.

lua/modules/plugins/editor.lua

+5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ editor["echasnovski/mini.align"] = {
5555
event = { "CursorHold", "CursorHoldI" },
5656
config = require("editor.align"),
5757
}
58+
editor["echasnovski/mini.cursorword"] = {
59+
lazy = true,
60+
event = { "BufReadPost", "BufAdd", "BufNewFile" },
61+
config = require("editor.cursorword"),
62+
}
5863
editor["smoka7/hop.nvim"] = {
5964
lazy = true,
6065
version = "*",

lua/modules/utils/init.lua

+9
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,15 @@ function M.gen_alpha_hl()
238238
set_global_hl("AlphaFooter", colors.yellow)
239239
end
240240

241+
-- Generate highlight groups for cursorword. Existing attributes will NOT be overwritten
242+
function M.gen_cursorword_hl()
243+
local colors = M.get_palette()
244+
245+
-- Do not highlight `MiniCursorwordCurrent`
246+
set_global_hl("MiniCursorword", nil, M.darken(colors.surface1, 0.7, colors.base))
247+
set_global_hl("MiniCursorwordCurrent", nil)
248+
end
249+
241250
---Convert number (0/1) to boolean
242251
---@param value number @The value to check
243252
---@return boolean|nil @Returns nil if failed

0 commit comments

Comments
 (0)