Skip to content

Commit

Permalink
feat: Support a buftype_allowlist
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewferrier committed May 25, 2024
1 parent 2491326 commit 4c87a23
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lua/wrapping/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ local OPTION_DEFAULTS = {
"typst", -- Supported from NeoVim 0.10+
},
auto_set_mode_filetype_denylist = {},
buftype_allowlist = {},
excluded_treesitter_queries = {
markdown = {
"(fenced_code_block) @markdown1",
Expand Down Expand Up @@ -249,7 +250,9 @@ end
M.set_mode_heuristically = function()
local buftype = vim.api.nvim_get_option_value("buftype", { buf = 0 })

if buftype ~= "" then
if
buftype ~= "" and not vim.tbl_contains(opts.buftype_allowlist, buftype)
then
log("Buftype is " .. buftype .. ", ignoring")
return
end
Expand Down Expand Up @@ -360,6 +363,7 @@ M.setup = function(o)
opts.auto_set_mode_filetype_denylist,
"table",
},
buftype_allowlist = { opts.buftype_allowlist, "table" },
notify_on_switch = { opts.notify_on_switch, "boolean" },
log_path = { opts.log_path, "string" },
})
Expand Down

0 comments on commit 4c87a23

Please sign in to comment.