Skip to content

Commit 4c87a23

Browse files
committed
feat: Support a buftype_allowlist
1 parent 2491326 commit 4c87a23

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lua/wrapping/init.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ local OPTION_DEFAULTS = {
2525
"typst", -- Supported from NeoVim 0.10+
2626
},
2727
auto_set_mode_filetype_denylist = {},
28+
buftype_allowlist = {},
2829
excluded_treesitter_queries = {
2930
markdown = {
3031
"(fenced_code_block) @markdown1",
@@ -249,7 +250,9 @@ end
249250
M.set_mode_heuristically = function()
250251
local buftype = vim.api.nvim_get_option_value("buftype", { buf = 0 })
251252

252-
if buftype ~= "" then
253+
if
254+
buftype ~= "" and not vim.tbl_contains(opts.buftype_allowlist, buftype)
255+
then
253256
log("Buftype is " .. buftype .. ", ignoring")
254257
return
255258
end
@@ -360,6 +363,7 @@ M.setup = function(o)
360363
opts.auto_set_mode_filetype_denylist,
361364
"table",
362365
},
366+
buftype_allowlist = { opts.buftype_allowlist, "table" },
363367
notify_on_switch = { opts.notify_on_switch, "boolean" },
364368
log_path = { opts.log_path, "string" },
365369
})

0 commit comments

Comments
 (0)