Skip to content

Commit c8b5361

Browse files
committed
fix(live): use fzf start event
chore: deprecate fzf < 0.35, should be ok, it's been out since Nov 2022
1 parent 32e19e0 commit c8b5361

4 files changed

Lines changed: 22 additions & 18 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Using [lazy.nvim](https://github.com/folke/lazy.nvim)
5656
### Dependencies
5757

5858
- [`neovim`](https://github.com/neovim/neovim/releases) version >= `0.9`
59-
- [`fzf`](https://github.com/junegunn/fzf) version > `0.25`
59+
- [`fzf`](https://github.com/junegunn/fzf) version > `0.35`
6060
or [`skim`](https://github.com/skim-rs/skim) binary installed
6161
- [nvim-web-devicons](https://github.com/nvim-tree/nvim-web-devicons)
6262
or [mini.icons](https://github.com/echasnovski/mini.icons)

doc/fzf-lua.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*fzf-lua.txt* For Neovim >= 0.9.0 Last change: 2025 June 28
1+
*fzf-lua.txt* For Neovim >= 0.9.0 Last change: 2025 July 12
22

33
==============================================================================
44
Table of Contents *fzf-lua-table-of-contents*
@@ -100,7 +100,7 @@ Using lazy.nvim <https://github.com/folke/lazy.nvim>
100100
DEPENDENCIES *fzf-lua-dependencies*
101101

102102
- `neovim` <https://github.com/neovim/neovim/releases> version >= `0.9`
103-
- `fzf` <https://github.com/junegunn/fzf> version > `0.25` or `skim`
103+
- `fzf` <https://github.com/junegunn/fzf> version > `0.35` or `skim`
104104
<https://github.com/skim-rs/skim> binary installed
105105
- nvim-web-devicons <https://github.com/nvim-tree/nvim-web-devicons> or
106106
mini.icons <https://github.com/echasnovski/mini.icons> (optional)
@@ -1146,7 +1146,7 @@ CUSTOMIZATION *fzf-lua-customization*
11461146
},
11471147
quickfix = {
11481148
file_icons = true,
1149-
only_valid = false, -- select among only the valid quickfix entries
1149+
valid_only = false, -- select among only the valid quickfix entries
11501150
},
11511151
quickfix_stack = {
11521152
prompt = "Quickfix Stack> ",
@@ -1624,4 +1624,4 @@ I missed your name feel free to contact me and I'll add it below:
16241624
previewer code while using nvim-bqf
16251625
<https://github.com/kevinhwang91/nvim-bqf>
16261626

1627-
vim:tw=78:ts=8:ft=help:norl:
1627+
vim:tw=78:ts=8:ft=help:norl:

lua/fzf-lua/config.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,8 +671,8 @@ function M.normalize_opts(opts, globals, __resume_key)
671671
if not opts.__FZF_VERSION then
672672
utils.err(string.format("'fzf --version' failed with error %s: %s", rc, err))
673673
return nil
674-
elseif not utils.has(opts, "fzf", { 0, 25 }) then
675-
utils.err(string.format("fzf version %s is lower than minimum (0.25), aborting.",
674+
elseif not utils.has(opts, "fzf", { 0, 35 }) then
675+
utils.err(string.format("fzf version %s is lower than minimum (0.35), aborting.",
676676
utils.ver2str(opts.__FZF_VERSION)))
677677
return nil
678678
end

lua/fzf-lua/core.lua

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,7 @@ M.fzf_live = function(contents, opts)
175175
opts.fn_reload = shell.stringify(contents, opts)
176176
local fzf_field_index = M.fzf_field_index(opts)
177177
local cmd = M.expand_query(opts.fn_reload, fzf_field_index)
178-
opts = M.setup_fzf_interactive_flags(cmd, fzf_field_index, opts)
179-
contents = opts.__fzf_init_cmd
178+
contents, opts = M.setup_fzf_interactive_flags(cmd, fzf_field_index, opts)
180179
return M.fzf_wrap(contents, opts)
181180
end
182181

@@ -192,7 +191,7 @@ M.fzf_resume = function(opts)
192191
opts = M.set_header(opts, opts.headers or {})
193192
opts.cwd = opts.cwd and libuv.expand(opts.cwd) or nil
194193
opts.__resuming = true
195-
M.fzf_exec(config.__resume_data.contents, config.__resume_data.opts)
194+
M.fzf_wrap(config.__resume_data.contents, config.__resume_data.opts)
196195
end
197196

198197
---@param contents string?
@@ -1148,7 +1147,7 @@ end
11481147
---@param command string
11491148
---@param fzf_field_index string
11501149
---@param opts table
1151-
---@return table
1150+
---@return string?, table
11521151
M.setup_fzf_interactive_flags = function(command, fzf_field_index, opts)
11531152
-- query cannot be 'nil'
11541153
opts.query = opts.query or ""
@@ -1190,8 +1189,6 @@ M.setup_fzf_interactive_flags = function(command, fzf_field_index, opts)
11901189
)
11911190

11921191
if opts._is_skim then
1193-
-- skim interactive mode does not need a piped command
1194-
opts.__fzf_init_cmd = nil
11951192
opts.prompt = opts.__prompt or opts.prompt or opts.fzf_opts["--prompt"]
11961193
if opts.prompt then
11971194
opts.fzf_opts["--prompt"] = opts.prompt:match("[^%*]+")
@@ -1215,10 +1212,6 @@ M.setup_fzf_interactive_flags = function(command, fzf_field_index, opts)
12151212
opts._fzf_cli_args = string.format("--interactive --cmd %s",
12161213
libuv.shellescape(no_query_condi .. reload_command))
12171214
else
1218-
-- **send an empty table to avoid running $FZF_DEFAULT_COMMAND
1219-
-- The above seems to create a hang in some systems
1220-
-- use `true` as $FZF_DEFAULT_COMMAND instead (#510)
1221-
opts.__fzf_init_cmd = utils.shell_nop()
12221215
if opts.exec_empty_query or (opts.query and #opts.query > 0) then
12231216
local q = not utils.__IS_WINDOWS and opts.query
12241217
or libuv.escape_fzf(opts.query, utils.has(opts, "fzf", { 0, 52 }) and 0.52 or 0)
@@ -1234,9 +1227,20 @@ M.setup_fzf_interactive_flags = function(command, fzf_field_index, opts)
12341227
end
12351228
opts._fzf_cli_args = string.format("--bind=%s", libuv.shellescape(
12361229
string.format("change:reload:%s%s", no_query_condi, reload_command)))
1230+
if utils.has(opts, "fzf", { 0, 35 }) then
1231+
opts._fzf_cli_args = opts._fzf_cli_args .. string.format(" --bind=%s",
1232+
libuv.shellescape(string.format("start:reload:%s%s", no_query_condi, reload_command)))
1233+
-- NOTE: not needed since we deprecated fzf < v0.35
1234+
-- elseif opts.exec_empty_query or (opts.query and #opts.query > 0) then
1235+
-- local q = not utils.__IS_WINDOWS and opts.query
1236+
-- or libuv.escape_fzf(opts.query, utils.has(opts, "fzf", { 0, 52 }) and 0.52 or 0)
1237+
-- -- gsub doesn't like single % on rhs
1238+
-- local escaped_q = libuv.shellescape(q):gsub("%%", "%%%%")
1239+
-- opts.__fzf_init_cmd = initial_command:gsub(fzf_field_index, escaped_q)
1240+
end
12371241
end
12381242

1239-
return opts
1243+
return utils.shell_nop(), opts
12401244
end
12411245

12421246
-- query placeholder for "live" queries

0 commit comments

Comments
 (0)