Skip to content

Commit 17e3507

Browse files
committed
chore: vim.F deprecated
1 parent cf4c308 commit 17e3507

7 files changed

Lines changed: 21 additions & 10 deletions

File tree

lua/fzf-lua/actions.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ end
515515
M.run_builtin = function(selected)
516516
if not selected[1] then return end
517517
local method = selected[1]
518-
local func = vim.F.nil_wrap(require "fzf-lua"[method])
518+
local func = utils.nil_wrap(require "fzf-lua"[method])
519519
if not _G.fzf_lua_stopinsert_hack then return func() end
520520
_G.fzf_lua_stopinsert_hack(func)
521521
end

lua/fzf-lua/make_entry.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ local glob_filter = function(paths, globs)
241241
-- globpath() is very slow
242242
local matchers
243243
if not globs or not vim.regex then return paths end
244-
local pats = vim.tbl_map(vim.F.nil_wrap(vim.fn.glob2regpat), globs)
245-
matchers = vim.tbl_map(vim.F.nil_wrap(vim.regex), pats)
244+
local pats = vim.tbl_map(utils.nil_wrap(vim.fn.glob2regpat), globs)
245+
matchers = vim.tbl_map(utils.nil_wrap(vim.regex), pats)
246246
-- matchers = vim.tbl_map(vim.F.nil_wrap(vim.glob.to_lpeg), globs)
247247
if #matchers == 0 then return paths end
248248
return vim.tbl_filter(function(p)

lua/fzf-lua/previewer/builtin.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Previewer.base = Object:extend()
4747
---@param opts table
4848
---@return fzf-lua.previewer.Builtin
4949
function Previewer.base:new(o, opts)
50-
local default = vim.F.if_nil
50+
local default = utils.nonnil
5151
o = o or {}
5252
self.type = "builtin"
5353
self.opts = opts
@@ -885,7 +885,7 @@ function Previewer.buffer_or_file:_set_preview_lines(tmpbuf, entry)
885885
extmarks = entry.extmarks or extmarks
886886
pcall(api.nvim_buf_set_lines, tmpbuf, 0, -1, false, textlines)
887887
if extmarks and #extmarks > 0 then
888-
local setmark = vim.F.nil_wrap(api.nvim_buf_set_extmark)
888+
local setmark = utils.nil_wrap(api.nvim_buf_set_extmark)
889889
local ns = api.nvim_create_namespace("fzf-lua.preview.hl")
890890
for _, extmark in ipairs(extmarks) do
891891
setmark(tmpbuf, ns, extmark.row, extmark.col,
@@ -1333,7 +1333,7 @@ function Previewer.buffer_or_file:set_cursor_hl(entry)
13331333
if not extmark and hls.cursor and entry.col and entry.col > 0 then
13341334
local end_lnum, end_col = entry.end_line or lnum, entry.end_col or col + 1
13351335
-- stale line/col can cause out-of-range, e.g. marks
1336-
vim.F.nil_wrap(api.nvim_buf_set_extmark)(buf, self.ns_previewer, lnum - 1, col - 1, {
1336+
utils.nil_wrap(api.nvim_buf_set_extmark)(buf, self.ns_previewer, lnum - 1, col - 1, {
13371337
end_line = end_lnum - 1,
13381338
end_col = math.max(1, end_col) - 1,
13391339
hl_group = entry.hlgroup or hls.cursor,

lua/fzf-lua/profiles/cli.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ if NVIM_RUNTIME then vim.env.VIMRUNTIME = NVIM_RUNTIME end
44

55
---@diagnostic disable-next-line: deprecated
66
local api, uv, fn = vim.api, vim.uv or vim.loop, vim.fn
7-
---@module 'ffi'?
8-
local ffi = vim.F.npcall(require, "ffi")
7+
local ffi
8+
if package.preload.ffi then
9+
ffi = package.preload.ffi()
10+
end
911

1012
pcall(function()
1113
ffi.cdef [[

lua/fzf-lua/utils.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,5 +1765,15 @@ end
17651765
---@class fzf-lua.wo: vim.wo,{}
17661766
M.wo = new_win_opt_accessor()
17671767

1768+
---@diagnostic disable-next-line: deprecated
1769+
M.nonnil = vim.nonnil or vim.F.if_nil
1770+
1771+
---@diagnostic disable-next-line: deprecated
1772+
M.npcall = vim.npcall or vim.F.npcall
1773+
1774+
---@diagnostic disable-next-line: deprecated
1775+
M.nil_wrap = not vim.nonnil and vim.F.nil_wrap or function(fn)
1776+
return function(...) return M.npcall(fn, ...) end
1777+
end
17681778

17691779
return M

lua/fzf-lua/win.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ function FzfWin.new(o)
723723
self.preview_hidden = not not o.winopts.preview.hidden -- force boolean
724724
self.keymap = o.keymap
725725
self.previewer = o.previewer
726-
self:set_autoclose(vim.F.if_nil(o.autoclose, true))
726+
self:set_autoclose(utils.nonnil(o.autoclose, true))
727727
self.winopts = self:normalize_winopts()
728728
self.on_closes = {}
729729
_self = self

tests/actions_spec.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ T["actions"] = new_set({ n_retry = not helpers.IS_LINUX() and 5 or nil })
1818
T["actions"]["ui don't freeze on error"] = function()
1919
helpers.SKIP_IF_NOT_NIGHTLY()
2020
helpers.SKIP_IF_WIN()
21-
MiniTest.skip("https://github.com/ibhagwan/fzf-lua/issues/2683")
2221
-- reload({ "hide" })
2322
local screen_opts = { start_line = 1, end_line = 10, ignore_text = { 28 } }
2423
-- fix flaky hit enter prompt on windows

0 commit comments

Comments
 (0)