Skip to content

Commit a03d68e

Browse files
netmuteibhagwan
authored andcommitted
feat: allow register_ui_select via setup options
This allows configuration in e.g. lazy.nvim to simply be: ```lua opts = { ui_select = true, }, ``` instead of needing to override the setup() call.
1 parent ab0d013 commit a03d68e

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

OPTIONS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,14 @@ Example, opening a floating help window at the top of screen with single border:
137137
})
138138
```
139139

140+
#### setup.ui_select
141+
142+
Type: `boolean|table|function`, Default: `false`
143+
144+
Register fzf-lua as the UI interface for `vim.ui.select` during `setup`.
145+
146+
When set to a table or function, the value is passed to `register_ui_select`.
147+
140148
---
141149

142150
## Global Options

doc/fzf-lua-opts.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*fzf-lua-opts.txt* For Neovim >= 0.8.0 Last change: 2025 October 24
1+
*fzf-lua-opts.txt* For Neovim >= 0.8.0 Last change: 2026 January 03
22

33
==============================================================================
44
Table of Contents *fzf-lua-opts-table-of-contents*
@@ -175,6 +175,16 @@ border:
175175
})
176176
<
177177

178+
179+
setup.ui_select *fzf-lua-opts-setup.ui_select*
180+
181+
Type: `boolean|table|function`, Default: `false`
182+
183+
Register fzf-lua as the UI interface for `vim.ui.select` during `setup`.
184+
185+
When set to a table or function, the value is passed to `register_ui_select`.
186+
187+
178188
------------------------------------------------------------------------------
179189
GLOBAL OPTIONS *fzf-lua-opts-global-options*
180190

@@ -1626,7 +1636,7 @@ Neovim's autocmds
16261636

16271637

16281638

1629-
undo *fzf-lua-opts-undo*
1639+
undotree *fzf-lua-opts-undotree*
16301640

16311641
History undo tree
16321642

lua/fzf-lua/init.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,12 @@ function M.setup(opts, do_not_reset_defaults)
232232
config.setup_opts = opts
233233
-- setup highlights
234234
M.setup_highlights()
235+
-- opt-in register ui.select via setup
236+
if opts.ui_select then
237+
M.register_ui_select((type(opts.ui_select) == "table" or type(opts.ui_select) == "function")
238+
and opts.ui_select or nil,
239+
true) -- silent
240+
end
235241
end
236242

237243
M.redraw = function()

0 commit comments

Comments
 (0)