Skip to content

Commit

Permalink
fix: Support OptionSet as an event
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewferrier committed May 25, 2024
1 parent ee438c3 commit 2491326
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lua/wrapping/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,9 @@ local function get_excluded_treesitter()
return tree_lines, tree_chars
end

local function auto_heuristic()
log("Testing for auto heuristic...")
---@param reason string
local function auto_heuristic(reason)
log("Testing for auto heuristic because of event " .. reason)

if vim.b.wrapmode ~= nil then
log("wrapmode already set for this buffer")
Expand Down Expand Up @@ -422,7 +423,16 @@ M.setup = function(o)
-- we can use what's in there.
vim.api.nvim_create_autocmd("BufWinEnter", {
group = vim.api.nvim_create_augroup("wrapping", {}),
callback = auto_heuristic,
callback = function()
auto_heuristic("BufWinEnter")
end,
})

vim.api.nvim_create_autocmd("OptionSet", {
pattern = "filetype",
callback = function()
auto_heuristic("OptionSet")
end,
})
end
end
Expand Down

0 comments on commit 2491326

Please sign in to comment.