-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathconfig.lua
More file actions
57 lines (53 loc) · 1.33 KB
/
Copy pathconfig.lua
File metadata and controls
57 lines (53 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
local CFG = {
_cfg = {
-- Whether the float preview is enabled by default. When set to false, it has to be "toggled" on.
toggled_on = true,
-- preview in background
auto_preview = true,
-- wrap nvimtree commands
wrap_nvimtree_commands = true,
-- lines for scroll
scroll_lines = 20,
-- window config
window = {
style = "minimal",
relative = "win",
border = "rounded",
wrap = false,
trim_height = true,
},
mapping = {
-- scroll down float buffer
down = { "<C-d>" },
-- scroll up float buffer
up = { "<C-e>", "<C-u>" },
-- enable/disable float windows
toggle = { "<C-x>" },
},
-- hooks if return false preview doesn't shown
hooks = {
pre_open = function(path)
-- if file > 5 MB or not text -> not preview
local size = require("float-preview.utils").get_size(path)
if type(size) ~= "number" then
return false
end
local is_text = require("float-preview.utils").is_text(path)
return size < 5 and is_text
end,
post_open = function(bufnr)
return true
end,
},
},
}
CFG.config = function()
return CFG._cfg
end
CFG.update = function(cfg)
if not cfg then
return
end
CFG._cfg = vim.tbl_extend("force", CFG._cfg, cfg)
end
return CFG