Skip to content

Commit abe1ce8

Browse files
committed
feat: store current window highlighturl state
1 parent a6cdc70 commit abe1ce8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lua/astrocore/init.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,14 +311,18 @@ function M.delete_url_match(win)
311311
for _, match in ipairs(vim.fn.getmatches(win)) do
312312
if match.group == "HighlightURL" then vim.fn.matchdelete(match.id, win) end
313313
end
314+
vim.w[win].highlighturl_enabled = false
314315
end
315316

316317
--- Add syntax matching rules for highlighting URLs/URIs
317318
---@param win integer? the window id to remove url highlighting in (default: current window)
318319
function M.set_url_match(win)
319320
if not win then win = vim.api.nvim_get_current_win() end
320321
M.delete_url_match(win)
321-
if M.config.features.highlighturl then vim.fn.matchadd("HighlightURL", M.url_matcher, 15, -1, { window = win }) end
322+
if M.config.features.highlighturl then
323+
vim.fn.matchadd("HighlightURL", M.url_matcher, 15, -1, { window = win })
324+
vim.w[win].highlighturl_enabled = true
325+
end
322326
end
323327

324328
--- Run a shell command and capture the output and if the command succeeded or failed

0 commit comments

Comments
 (0)