Skip to content

Commit bf498b9

Browse files
committed
feat(skim): enable hide profile for skim >= v1.5.3
1 parent 20e2d30 commit bf498b9

4 files changed

Lines changed: 10 additions & 3 deletions

File tree

lua/fzf-lua/config.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,7 @@ function M.normalize_opts(opts, globals, __resume_key) ---@diagnostic disable
745745
local bin, version, changelog = (function()
746746
if opts.__SK_VERSION then
747747
return "sk", opts.__SK_VERSION, {
748+
["1.5.3"] = { fzf_opts = { ["--algo"] = "frizbee" } },
748749
["0.15.5"] = { fzf_opts = { ["--tmux"] = true } },
749750
["0.53"] = { fzf_opts = { ["--inline-info"] = true } },
750751
-- All fzf flags not existing in skim
@@ -811,6 +812,7 @@ function M.normalize_opts(opts, globals, __resume_key) ---@diagnostic disable
811812
-- All skim flags not existing in fzf
812813
["all"] = {
813814
fzf_opts = {
815+
["--algo"] = false,
814816
["--inline-info"] = false,
815817
}
816818
},

lua/fzf-lua/core.lua

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,7 @@ end
10391039
---@return table
10401040
M.convert_exec_silent_actions = function(opts)
10411041
-- `execute-silent` actions are bugged with skim (can't use quotes)
1042-
if utils.has(opts, "sk") then
1042+
if utils.has(opts, "sk") and not utils.has(opts, "sk", { 1, 5, 3 }) then
10431043
return opts
10441044
end
10451045
for k, v in pairs(opts.actions) do
@@ -1151,7 +1151,10 @@ M.fzf_query_placeholder = "<query>"
11511151
M.fzf_field_index = function(opts)
11521152
-- fzf already adds single quotes around the placeholder when expanding.
11531153
-- for skim we surround it with double quotes or single quote searches fail
1154-
return opts and opts.field_index or opts._is_skim and [["{}"]] or "{q}"
1154+
-- skim >= v1.5.3 already escapes the field index
1155+
return opts and opts.field_index
1156+
or utils.has(opts, "sk") and not utils.has(opts, "sk", { 1, 5, 3 }) and [["{}"]]
1157+
or "{q}"
11551158
end
11561159

11571160
---@param cmd string

lua/fzf-lua/defaults.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ M.defaults = {
265265
["--layout"] = "reverse",
266266
["--border"] = "none",
267267
["--highlight-line"] = true,
268+
-- typo-resistant algo with skim >= v1.5.3
269+
["--algo"] = "frizbee",
268270
},
269271
---Options passed to fzf-tmux wrapper.
270272
fzf_tmux_opts = { ["-p"] = "80%,80%", ["--margin"] = "0,0" },

lua/fzf-lua/profiles/hide.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ return {
2525
opts.actions = opts.actions or {}
2626
assert(opts.keymap)
2727
assert(opts.keymap.builtin)
28-
if fzf.utils.has(opts, "sk") then
28+
if fzf.utils.has(opts, "sk") and not fzf.utils.has(opts, "sk", { 1, 5, 3 }) then
2929
-- `execute-silent` actions are bugged with skim
3030
-- Set esc to hide since we aren't using the custom callback
3131
opts.actions["esc"] = false

0 commit comments

Comments
 (0)