fix(float): only set default filetype if no ft is set

This commit is contained in:
Folke Lemaitre 2024-11-03 23:04:59 +01:00
parent a528e77397
commit 66b252535c
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 4 additions and 6 deletions

View file

@ -33,9 +33,7 @@ local defaults = {
zindex = 50,
},
wo = {},
bo = {
filetype = "snacks_float",
},
bo = {},
keys = {
q = "close",
},
@ -115,8 +113,8 @@ function M:show()
else
self.buf = vim.api.nvim_create_buf(false, true)
end
if self.opts.bo and vim.bo[self.buf].filetype ~= "" then
self.opts.bo.filetype = nil
if vim.bo[self.buf].filetype == "" and not self.opts.bo.filetype then
self.opts.bo.filetype = "snacks_float"
end
self:set_options("buf")
for k, v in pairs(self.opts.b or {}) do

View file

@ -64,8 +64,8 @@ function M.open(cmd, opts)
vim.cmd.startinsert()
end,
})
vim.cmd("noh")
end
vim.cmd("noh")
return float
end