Skip to content

Commit 5347181

Browse files
committed
(mini.cursorword) Update setup() to allow plugin hot reload.
1 parent bed5cc7 commit 5347181

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lua/mini/cursorword.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,14 @@ H.setup_config = function(config)
142142
return config
143143
end
144144

145-
H.apply_config = function(config) MiniCursorword.config = config end
145+
H.apply_config = function(config)
146+
MiniCursorword.config = config
147+
148+
-- Make `setup()` to proper reset module
149+
for _, m in ipairs(vim.fn.getmatches()) do
150+
if vim.startswith(m.group, 'MiniCursorword') then vim.fn.matchdelete(m.id) end
151+
end
152+
end
146153

147154
H.create_autocommands = function()
148155
local augroup = vim.api.nvim_create_augroup('MiniCursorword', {})

0 commit comments

Comments
 (0)