Skip to content

Commit

Permalink
fix: change the location in if else in autocmd module
Browse files Browse the repository at this point in the history
  • Loading branch information
sontungexpt committed Sep 15, 2023
1 parent d691fe3 commit f6d3a36
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lua/url-open/modules/autocmd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@ local M = {}

M.setup = function(user_opts)
if user_opts.highlight_url.enabled then
if not user_opts.highlight_url.cursor_only then
api.nvim_create_autocmd({ "VimEnter", "FileType", "BufEnter", "WinEnter" }, {
desc = "URL Highlighting",
group = api.nvim_create_augroup("HightlightAllUrl", { clear = true }),
callback = function() handlers.set_url_effect() end,
})
else
if user_opts.highlight_url.cursor_only then
api.nvim_create_autocmd({ "CursorMoved" }, {
desc = "URL Highlighting CursorMoved",
group = api.nvim_create_augroup("HighlightCursorUrl", { clear = true }),
Expand All @@ -23,6 +17,12 @@ M.setup = function(user_opts)
api.nvim_set_hl(0, "HighlightCursorUrl", { underline = true })
end,
})
else
api.nvim_create_autocmd({ "VimEnter", "FileType", "BufEnter", "WinEnter" }, {
desc = "URL Highlighting",
group = api.nvim_create_augroup("HightlightAllUrl", { clear = true }),
callback = function() handlers.set_url_effect() end,
})
end
end
end
Expand Down

0 comments on commit f6d3a36

Please sign in to comment.