-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathconfig.lua
More file actions
110 lines (103 loc) · 2.83 KB
/
config.lua
File metadata and controls
110 lines (103 loc) · 2.83 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
---@class BqfConfig
---@field auto_enable boolean
---@field magic_window boolean
---@field auto_resize_height boolean
---@field preview BqfConfigPreview
---@field func_map table<string, string>
---@field filter BqfConfigFilter
local def = {
auto_enable = true,
auto_close = true,
magic_window = true,
auto_resize_height = false,
previous_winid_ft_skip = {},
preview = {
auto_preview = true,
border = 'rounded',
show_title = true,
show_scroll_bar = true,
delay_syntax = 50,
winblend = 12,
win_height = 15,
win_vheight = 15,
wrap = false,
buf_label = true,
should_preview_cb = nil
},
func_map = {
open = '<CR>',
openc = 'o',
drop = 'O',
split = '<C-x>',
vsplit = '<C-v>',
tab = 't',
tabb = 'T',
tabc = '<C-t>',
tabdrop = '',
ptogglemode = 'zp',
ptoggleitem = 'p',
ptoggleauto = 'P',
pscrollup = '<C-b>',
pscrolldown = '<C-f>',
pscrollorig = 'zo',
prevfile = '<C-p>',
nextfile = '<C-n>',
prevhist = '<',
nexthist = '>',
lastleave = [['"]],
stoggleup = '<S-Tab>',
stoggledown = '<Tab>',
stogglevm = '<Tab>',
stogglebuf = [['<Tab>]],
sclear = 'z<Tab>',
filter = 'zn',
filterr = 'zN',
fzffilter = 'zf'
},
filter = {
fzf = {
action_for = {
['ctrl-t'] = 'tabedit',
['ctrl-v'] = 'vsplit',
['ctrl-x'] = 'split',
['ctrl-q'] = 'signtoggle',
['ctrl-c'] = 'closeall'
},
extra_opts = {'--bind', 'ctrl-o:toggle-all'}
}
}
}
---@class BqfConfigPreview
---@field auto_preview boolean
---@field border string|string[]
---@field show_title boolean
---@field show_scroll_bar boolean
---@field delay_syntax number
---@field win_height number
---@field win_vheight number
---@field winblend number
---@field wrap boolean
---@field buf_label boolean
---@field should_preview_cb fun(bufnr: number, qwinid: number): boolean
---@class BqfConfigFilter
---@field fzf BqfConfigFilterFzf
---@class BqfConfigFilterFzf
---@field action_for table<string, string>
---@field extra_opts string[]
---@type BqfConfig
local Config = {}
local function init()
local bqf = require('bqf')
Config = vim.tbl_deep_extend('keep', bqf._config or {}, def)
vim.validate({
auto_enable = {Config.auto_enable, 'boolean'},
magic_window = {Config.magic_window, 'boolean'},
auto_resize_height = {Config.auto_resize_height, 'boolean'},
preview = {Config.preview, 'table'},
func_map = {Config.func_map, 'table'},
filter = {Config.filter, 'table'}
})
bqf._config = nil
end
init()
return Config