Skip to content

Commit 4b86df8

Browse files
committed
feat: add cursor_color_insert_mode parameter
1 parent a1a6494 commit 4b86df8

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

lua/smear_cursor/color.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ local M = {}
1111
-- Smear cursor color. Defaults to Cursor GUI color if not set.
1212
-- Set to "none" to match the text color at the target cursor position.
1313
C.cursor_color = nil
14+
C.cursor_color_insert_mode = nil
1415

1516
-- Background color. Defaults to Normal GUI background color if not set.
1617
C.normal_bg = nil
@@ -45,6 +46,7 @@ C.cterm_bg = 235
4546

4647
M.config_variables = {
4748
"cursor_color",
49+
"cursor_color_insert_mode",
4850
"normal_bg",
4951
"transparent_bg_fallback_color",
5052
"cterm_cursor_colors",
@@ -106,14 +108,14 @@ function M.get_color_at_cursor()
106108
end
107109

108110
function M.update_color_at_cursor()
109-
if C.cursor_color ~= "none" then return end
111+
if C.cursor_color ~= "none" and C.cursor_color_insert_mode ~= "none" then return end
110112
color_at_cursor = M.get_color_at_cursor()
111113
end
112114

113115
---@param opts? {level?: number, inverted?: boolean}
114116
function M.get_hl_group(opts)
115117
opts = opts or {}
116-
local _cursor_color = C.cursor_color
118+
local _cursor_color = (vim.api.nvim_get_mode().mode == "i") and C.cursor_color_insert_mode or C.cursor_color
117119

118120
local hl_group = ("SmearCursor%s%s"):format(opts.inverted and "Inverted" or "", tostring(opts.level or ""))
119121

0 commit comments

Comments
 (0)