-
Notifications
You must be signed in to change notification settings - Fork 3
/
default.lua
138 lines (129 loc) · 3.77 KB
/
default.lua
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
---@class AllRecentConfig.Database
---@field folder string
---@field file string
---@field max_timestamps number
---@alias AllRecentSortingStrategyEnum "recent" | "frecency"
---@class AllRecentConfig.PickerSettings
---@field disable? bool
---@field use_cwd? bool
---@field sorting? AllRecentSortingStrategyEnum
---@class AllRecentConfig.KindSettings.Extra
---@field name_include_prompt? bool
---@field prompt? string
---@alias AllRecentConfig.KindSettings AllRecentConfig.PickerSettings | AllRecentConfig.KindSettings.Extra
---@class AllRecentConfig.VimUiSelectSettings
---@field kinds table<string, AllRecentConfig.KindSettings>
---@field prompts table<string, AllRecentConfig.PickerSettings>
---@class AllRecentConfig
---@field database AllRecentConfig.Database
---@field scoring { recency_modifier: AllRecentRecencyModifier[], boost_factor: number }
---@field default AllRecentConfig.PickerSettings
---@field debug bool
---@field pickers table<string, AllRecentConfig.PickerSettings> TODO: make the types dependent on telescope builtins
---@field vim_ui_select AllRecentConfig.VimUiSelectSettings
local stdpath_data = vim.fn.stdpath("data")
if type(stdpath_data) ~= "string" and vim.isarray(stdpath_data) then
stdpath_data = stdpath_data[1]
end
---@cast stdpath_data string
local data_folder = stdpath_data
---@type AllRecentConfig
local default_config = {
database = {
folder = data_folder,
file = "telescope-all-recent.sqlite3",
max_timestamps = 10,
},
scoring = {
recency_modifier = {
[1] = { age = 240, value = 100 }, -- past 4 hours
[2] = { age = 1440, value = 80 }, -- past day
[3] = { age = 4320, value = 60 }, -- past 3 days
[4] = { age = 10080, value = 40 }, -- past week
[5] = { age = 43200, value = 20 }, -- past month
[6] = { age = 129600, value = 10 }, -- past 90 days
},
boost_factor = 0.0001,
},
default = {
disable = true,
use_cwd = true,
sorting = "recent",
},
debug = false,
-- does not make sense for:
-- grep string
-- live grep (too many results)
-- TODO: buffers: might be useful for project/session, but: we must allow preprocesseing the string
--
-- oldfiles: are per definition already recent. If you need frecency files: use telescope-frecency
-- command history: already recent
-- search history: already recent
--
pickers = {
-- pickers explicitly enabled
-- not using cwd
man_pages = {
disable = false,
use_cwd = false,
},
vim_options = {
disable = false,
use_cwd = false,
},
pickers = {
disable = false,
use_cwd = false,
},
builtin = {
disable = false,
use_cwd = false,
},
planets = {
disable = false,
use_cwd = false,
},
commands = {
disable = false,
use_cwd = false,
},
help_tags = {
disable = false,
use_cwd = false,
},
-- using cwd
find_files = {
disable = false,
sorting = "frecency",
},
git_files = {
disable = false,
sorting = "frecency",
},
tags = {
disable = false,
},
git_commits = {
disable = false,
},
git_branches = {
disable = false,
},
-- some explicitly disabled pickers: I consider them not useful.
oldfiles = { disable = true },
live_grep = { disable = true },
grep_string = { disable = true },
command_history = { disable = true },
search_history = { disable = true },
current_buffer_fuzzy_find = { disable = true },
},
-- support for telescope invoked through vim.ui.select, e.g. using dressing.nvim
-- Specify the kind.
-- Potentially fix to a specific prompt only.
-- Other than that, all options are the same as for normal pickers
vim_ui_select = {
kinds = {},
prompts = {},
},
}
return default_config