Skip to content

Commit cbf8e44

Browse files
committed
fix: add shim for deprecated vim.F.if_nil
1 parent 6fea601 commit cbf8e44

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

lua/telescope/_extensions/fzf.lua

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
local fzf = require "fzf_lib"
22
local sorters = require "telescope.sorters"
33

4+
-- todo(clason): remove when dropping support for Nvim 0.12
5+
local nonnil = vim.nonnil or vim.F.if_nil
6+
47
local case_enum = setmetatable({
58
["smart_case"] = 0,
69
["ignore_case"] = 1,
@@ -112,8 +115,8 @@ end
112115

113116
local fast_extend = function(opts, conf)
114117
local ret = {}
115-
ret.case_mode = vim.F.if_nil(opts.case_mode, conf.case_mode)
116-
ret.fuzzy = vim.F.if_nil(opts.fuzzy, conf.fuzzy)
118+
ret.case_mode = nonnil(opts.case_mode, conf.case_mode)
119+
ret.fuzzy = nonnil(opts.fuzzy, conf.fuzzy)
117120
return ret
118121
end
119122

@@ -126,12 +129,12 @@ end
126129

127130
return require("telescope").register_extension {
128131
setup = function(ext_config, config)
129-
local override_file = vim.F.if_nil(ext_config.override_file_sorter, true)
130-
local override_generic = vim.F.if_nil(ext_config.override_generic_sorter, true)
132+
local override_file = nonnil(ext_config.override_file_sorter, true)
133+
local override_generic = nonnil(ext_config.override_generic_sorter, true)
131134

132135
local conf = {}
133-
conf.case_mode = vim.F.if_nil(ext_config.case_mode, "smart_case")
134-
conf.fuzzy = vim.F.if_nil(ext_config.fuzzy, true)
136+
conf.case_mode = nonnil(ext_config.case_mode, "smart_case")
137+
conf.fuzzy = nonnil(ext_config.fuzzy, true)
135138

136139
if override_file then
137140
config.file_sorter = wrap_sorter(conf)

0 commit comments

Comments
 (0)