|
1 | 1 | local M = {} |
2 | 2 |
|
3 | | ---@class fff.conf.State |
| 3 | +--- @class FffLayoutConfig |
| 4 | +--- @field height number |
| 5 | +--- @field width number |
| 6 | +--- @field prompt_position string |
| 7 | +--- @field preview_position string |
| 8 | +--- @field preview_size number |
| 9 | +--- @field show_scrollbar boolean |
| 10 | +--- @field path_shorten_strategy string |
| 11 | + |
| 12 | +--- @class FffPreviewConfig |
| 13 | +--- @field enabled boolean |
| 14 | +--- @field max_size number |
| 15 | +--- @field chunk_size number |
| 16 | +--- @field binary_file_threshold number |
| 17 | +--- @field imagemagick_info_format_str string |
| 18 | +--- @field line_numbers boolean |
| 19 | +--- @field wrap_lines boolean |
| 20 | +--- @field filetypes table<string, table> |
| 21 | + |
| 22 | +--- @class FffKeymapsConfig |
| 23 | +--- @field close string |
| 24 | +--- @field select string |
| 25 | +--- @field select_split string |
| 26 | +--- @field select_vsplit string |
| 27 | +--- @field select_tab string |
| 28 | +--- @field move_up string|string[] |
| 29 | +--- @field move_down string|string[] |
| 30 | +--- @field preview_scroll_up string |
| 31 | +--- @field preview_scroll_down string |
| 32 | +--- @field toggle_debug string |
| 33 | +--- @field cycle_grep_modes string |
| 34 | +--- @field cycle_previous_query string |
| 35 | +--- @field toggle_select string |
| 36 | +--- @field send_to_quickfix string |
| 37 | +--- @field focus_list string |
| 38 | +--- @field focus_preview string |
| 39 | + |
| 40 | +--- @class FffFrecencyConfig |
| 41 | +--- @field enabled boolean |
| 42 | +--- @field db_path string |
| 43 | + |
| 44 | +--- @class FffHistoryConfig |
| 45 | +--- @field enabled boolean |
| 46 | +--- @field db_path string |
| 47 | +--- @field min_combo_count number |
| 48 | +--- @field combo_boost_score_multiplier number |
| 49 | + |
| 50 | +--- @class FffGrepConfig |
| 51 | +--- @field max_file_size number |
| 52 | +--- @field max_matches_per_file number |
| 53 | +--- @field smart_case boolean |
| 54 | +--- @field time_budget_ms number |
| 55 | +--- @field modes string[] |
| 56 | + |
| 57 | +--- @class FffConfig |
| 58 | +--- @field base_path string |
| 59 | +--- @field prompt string |
| 60 | +--- @field title string |
| 61 | +--- @field max_results number |
| 62 | +--- @field max_threads number |
| 63 | +--- @field lazy_sync boolean |
| 64 | +--- @field layout FffLayoutConfig |
| 65 | +--- @field preview FffPreviewConfig |
| 66 | +--- @field keymaps FffKeymapsConfig |
| 67 | +--- @field hl table<string, string> |
| 68 | +--- @field frecency FffFrecencyConfig |
| 69 | +--- @field history FffHistoryConfig |
| 70 | +--- @field git table |
| 71 | +--- @field debug table |
| 72 | +--- @field logging table |
| 73 | +--- @field file_picker table |
| 74 | +--- @field grep FffGrepConfig |
| 75 | + |
| 76 | +---@class fff.conf.State |
4 | 77 | local state = { |
5 | | - ---@type table | nil |
| 78 | + ---@type FffConfig|nil |
6 | 79 | config = nil, |
7 | 80 | } |
8 | 81 |
|
@@ -162,7 +235,7 @@ local function init() |
162 | 235 | preview_scroll_down = '<C-d>', |
163 | 236 | toggle_debug = '<F2>', |
164 | 237 | -- grep mode: cycle between plain text, regex, and fuzzy search |
165 | | - toggle_grep_regex = '<S-Tab>', |
| 238 | + cycle_grep_modes = '<S-Tab>', |
166 | 239 | -- goes to the previous query in history |
167 | 240 | cycle_previous_query = '<C-Up>', |
168 | 241 | -- multi-select keymaps for quickfix |
@@ -264,10 +337,10 @@ local function init() |
264 | 337 | end |
265 | 338 |
|
266 | 339 | --- Setup the file picker with the given configuration |
267 | | ---- @param config table Configuration options |
| 340 | +--- @param config FffConfig Configuration options |
268 | 341 | function M.setup(config) vim.g.fff = config end |
269 | 342 |
|
270 | | ---- @return table the fff configuration |
| 343 | +--- @return FffConfig the fff configuration |
271 | 344 | function M.get() |
272 | 345 | if not state.config then init() end |
273 | 346 | return state.config |
|
0 commit comments