Skip to content

Commit

Permalink
feat: setup highlighturl capabilities on setup
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter committed Jun 3, 2024
1 parent 879b67b commit 3bf9e36
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions lua/astrocore/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,30 @@ function M.setup(opts)
})
end

-- set up highlighturl
local highlighturl_group = vim.api.nvim_create_augroup("highlighturl", { clear = true })
vim.api.nvim_set_hl(0, "HighlightURL", { default = true, underline = true })
vim.api.nvim_create_autocmd("ColorScheme", {
group = highlighturl_group,
desc = "Set up HighlightURL hlgroup",
callback = function() vim.api.nvim_set_hl(0, "HighlightURL", { default = true, underline = true }) end,
})
vim.api.nvim_create_autocmd({ "VimEnter", "FileType", "BufEnter", "WinEnter" }, {
group = highlighturl_group,
desc = "Highlight URLs",
callback = function(args)
for _, win in ipairs(vim.api.nvim_list_wins()) do
if
vim.api.nvim_win_get_buf(win) == args.buf
and vim.tbl_get(require "astrocore", "config", "features", "highlighturl")
and not vim.w[win].highlighturl_enabled
then
M.set_url_match(win)
end
end
end,
})

-- initialize rooter
if vim.tbl_get(M.config, "rooter", "enabled") then
local root_config = M.config.rooter --[[@as AstroCoreRooterOpts]]
Expand Down

0 comments on commit 3bf9e36

Please sign in to comment.