fix: preview = true (#2168)
This commit is contained in:
@@ -845,6 +845,9 @@ function config.set_defaults(user_defaults, tele_defaults)
|
|||||||
if user_defaults[name] == false or config.values[name] == false then
|
if user_defaults[name] == false or config.values[name] == false then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
if user_defaults[name] == true then
|
||||||
|
return vim.F.if_nil(config.values[name], {})
|
||||||
|
end
|
||||||
|
|
||||||
return smarter_depth_2_extend(
|
return smarter_depth_2_extend(
|
||||||
vim.F.if_nil(user_defaults[name], {}),
|
vim.F.if_nil(user_defaults[name], {}),
|
||||||
|
|||||||
@@ -152,11 +152,13 @@ local scroll_fn = function(self, direction)
|
|||||||
end
|
end
|
||||||
|
|
||||||
previewers.file_maker = function(filepath, bufnr, opts)
|
previewers.file_maker = function(filepath, bufnr, opts)
|
||||||
opts = opts or {}
|
opts = vim.F.if_nil(opts, {})
|
||||||
opts.preview = opts.preview or {}
|
-- TODO(conni2461): here shouldn't be any hardcoded magic numbers ...
|
||||||
|
opts.preview = vim.F.if_nil(opts.preview, {})
|
||||||
opts.preview.timeout = vim.F.if_nil(opts.preview.timeout, 250) -- in ms
|
opts.preview.timeout = vim.F.if_nil(opts.preview.timeout, 250) -- in ms
|
||||||
opts.preview.filesize_limit = vim.F.if_nil(opts.preview.filesize_limit, 25) -- in mb
|
opts.preview.filesize_limit = vim.F.if_nil(opts.preview.filesize_limit, 25) -- in mb
|
||||||
opts.preview.msg_bg_fillchar = vim.F.if_nil(opts.preview.msg_bg_fillchar, "╱") -- in mb
|
opts.preview.msg_bg_fillchar = vim.F.if_nil(opts.preview.msg_bg_fillchar, "╱") -- in mb
|
||||||
|
opts.preview.treesitter = vim.F.if_nil(opts.preview.treesitter, true)
|
||||||
if opts.use_ft_detect == nil then
|
if opts.use_ft_detect == nil then
|
||||||
opts.use_ft_detect = true
|
opts.use_ft_detect = true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -78,9 +78,22 @@ end
|
|||||||
|
|
||||||
--- Attach default highlighter which will choose between regex and ts
|
--- Attach default highlighter which will choose between regex and ts
|
||||||
utils.highlighter = function(bufnr, ft, opts)
|
utils.highlighter = function(bufnr, ft, opts)
|
||||||
opts = opts or {}
|
opts = vim.F.if_nil(opts, {})
|
||||||
opts.preview = opts.preview or {}
|
opts.preview = vim.F.if_nil(opts.preview, {})
|
||||||
opts.preview.treesitter = vim.F.if_nil(opts.preview.treesitter, conf.preview.treesitter)
|
opts.preview.treesitter = (function()
|
||||||
|
if type(opts.preview) == "table" and opts.preview.treesitter then
|
||||||
|
return opts.preview.treesitter
|
||||||
|
end
|
||||||
|
if type(conf.preview) == "table" and conf.preview.treesitter then
|
||||||
|
return conf.preview.treesitter
|
||||||
|
end
|
||||||
|
if type(conf.preview) == "boolean" then
|
||||||
|
return conf.preview
|
||||||
|
end
|
||||||
|
-- We should never get here
|
||||||
|
return false
|
||||||
|
end)()
|
||||||
|
|
||||||
if type(opts.preview.treesitter) == "boolean" then
|
if type(opts.preview.treesitter) == "boolean" then
|
||||||
local temp = { enable = opts.preview.treesitter }
|
local temp = { enable = opts.preview.treesitter }
|
||||||
opts.preview.treesitter = temp
|
opts.preview.treesitter = temp
|
||||||
|
|||||||
Reference in New Issue
Block a user