1- *fzf-lua.txt* For Neovim >= 0.9.0 Last change: 2025 September 14
1+ *fzf-lua.txt* For Neovim >= 0.9.0 Last change: 2025 September 16
22
33==============================================================================
44Table of Contents *fzf-lua-table-of-contents*
@@ -163,14 +163,15 @@ Fzf-lua aims to be as plug and play as possible with sane defaults, you can
163163run any fzf-lua command like this:
164164
165165>lua
166- :lua require('fzf-lua').files()
167- -- or using the `FzfLua` vim command:
166+ :lua require("fzf-lua").files()
167+ -- once loaded we can use the global object
168+ :lua FzfLua.files()
169+ -- or the vim command:
168170 :FzfLua files
169171<
170172or with arguments:
171173
172174>lua
173- -- Once fzf-lua is loaded you can also use the lua global `_G.FzfLua`
174175 :lua FzfLua.files({ cwd = '~/.config' })
175176 -- or using the `FzfLua` vim command:
176177 :FzfLua files cwd=~/.config
@@ -440,7 +441,7 @@ CUSTOMIZATION *fzf-lua-customization*
440441 usage notes and a comprehensive list of yet more(!) available options.
441442
442443>lua
443- require("fzf-lua").setup{
444+ require("fzf-lua").setup {
444445 -- MISC GLOBAL SETUP OPTIONS, SEE BELOW
445446 -- fzf_bin = ...,
446447 -- each of these options can also be passed as function that return options table
@@ -592,7 +593,6 @@ CUSTOMIZATION *fzf-lua-customization*
592593 },
593594<
594595>lua
595- local actions = require("fzf-lua").actions
596596 actions = {
597597 -- Below are the default actions, setting any value in these tables will override
598598 -- the defaults, to inherit from the defaults change [1] from `false` to `true`
@@ -604,15 +604,15 @@ CUSTOMIZATION *fzf-lua-customization*
604604 -- `file_edit_or_qf` opens a single selection or sends multiple selection to quickfix
605605 -- replace `enter` with `file_edit` to open all files/bufs whether single or multiple
606606 -- replace `enter` with `file_switch_or_edit` to attempt a switch in current tab first
607- ["enter"] = actions.file_edit_or_qf,
608- ["ctrl-s"] = actions.file_split,
609- ["ctrl-v"] = actions.file_vsplit,
610- ["ctrl-t"] = actions.file_tabedit,
611- ["alt-q"] = actions.file_sel_to_qf,
612- ["alt-Q"] = actions.file_sel_to_ll,
613- ["alt-i"] = actions.toggle_ignore,
614- ["alt-h"] = actions.toggle_hidden,
615- ["alt-f"] = actions.toggle_follow,
607+ ["enter"] = FzfLua. actions.file_edit_or_qf,
608+ ["ctrl-s"] = FzfLua. actions.file_split,
609+ ["ctrl-v"] = FzfLua. actions.file_vsplit,
610+ ["ctrl-t"] = FzfLua. actions.file_tabedit,
611+ ["alt-q"] = FzfLua. actions.file_sel_to_qf,
612+ ["alt-Q"] = FzfLua. actions.file_sel_to_ll,
613+ ["alt-i"] = FzfLua. actions.toggle_ignore,
614+ ["alt-h"] = FzfLua. actions.toggle_hidden,
615+ ["alt-f"] = FzfLua. actions.toggle_follow,
616616 },
617617 }
618618<
@@ -1044,7 +1044,7 @@ CUSTOMIZATION *fzf-lua-customization*
10441044 cwd_only = false,
10451045 stat_file = true, -- verify files exist on disk
10461046 -- can also be a lua function, for example:
1047- -- stat_file = require("fzf-lua") .utils.file_is_readable,
1047+ -- stat_file = FzfLua .utils.file_is_readable,
10481048 -- stat_file = function() return true end,
10491049 include_current_session = false, -- include bufs from current session
10501050 },
@@ -1274,13 +1274,13 @@ CUSTOMIZATION *fzf-lua-customization*
12741274 -- by default display all LSP locations
12751275 -- to customize, duplicate table and delete unwanted providers
12761276 providers = {
1277- { "references", prefix = require("fzf-lua") .utils.ansi_codes.blue("ref ") },
1278- { "definitions", prefix = require("fzf-lua") .utils.ansi_codes.green("def ") },
1279- { "declarations", prefix = require("fzf-lua") .utils.ansi_codes.magenta("decl") },
1280- { "typedefs", prefix = require("fzf-lua") .utils.ansi_codes.red("tdef") },
1281- { "implementations", prefix = require("fzf-lua") .utils.ansi_codes.green("impl") },
1282- { "incoming_calls", prefix = require("fzf-lua") .utils.ansi_codes.cyan("in ") },
1283- { "outgoing_calls", prefix = require("fzf-lua") .utils.ansi_codes.yellow("out ") },
1277+ { "references", prefix = FzfLua .utils.ansi_codes.blue("ref ") },
1278+ { "definitions", prefix = FzfLua .utils.ansi_codes.green("def ") },
1279+ { "declarations", prefix = FzfLua .utils.ansi_codes.magenta("decl") },
1280+ { "typedefs", prefix = FzfLua .utils.ansi_codes.red("tdef") },
1281+ { "implementations", prefix = FzfLua .utils.ansi_codes.green("impl") },
1282+ { "incoming_calls", prefix = FzfLua .utils.ansi_codes.cyan("in ") },
1283+ { "outgoing_calls", prefix = FzfLua .utils.ansi_codes.yellow("out ") },
12841284 },
12851285 }
12861286 },
@@ -1366,12 +1366,12 @@ Using `files` with a different command and working directory:
13661366Using `live_grep` with `git grep`:
13671367
13681368>lua
1369- :lua require'fzf-lua' .live_grep({ cmd = "git grep --line-number --column --color=always" })
1369+ :lua FzfLua .live_grep({ cmd = "git grep --line-number --column --color=always" })
13701370<
13711371`spell_suggest` with non-default window size relative to cursor:
13721372
13731373>lua
1374- :lua require'fzf-lua' .spell_suggest({ winopts = { height=0.33, width=0.33, relative="cursor" } })
1374+ :lua FzfLua .spell_suggest({ winopts = { height=0.33, width=0.33, relative="cursor" } })
13751375 -- Or via the vimL command
13761376 :FzfLua spell_suggest winopts={height=0.33,width=0.33,relative=cursor}
13771377 :FzfLua spell_suggest winopts={height=0.33,width=0.33} winopts.relative=cursor
@@ -1461,7 +1461,7 @@ path/completion using `<C-x><C-f>`:
14611461
14621462>lua
14631463 vim.keymap.set({ "n", "v", "i" }, "<C-x><C-f> ",
1464- function() require("fzf-lua") .complete_path() end,
1464+ function() FzfLua .complete_path() end,
14651465 { silent = true, desc = "Fuzzy complete path" })
14661466<
14671467Or with a custom command and preview:
@@ -1472,7 +1472,7 @@ Or with a custom command and preview:
14721472>lua
14731473 vim.keymap.set({ "i" }, "<C-x><C-f> ",
14741474 function()
1475- require("fzf-lua") .complete_file({
1475+ FzfLua .complete_file({
14761476 cmd = "rg --files",
14771477 winopts = { preview = { hidden = true } }
14781478 })
@@ -1489,14 +1489,14 @@ sending `complete = true` in the options:
14891489 `p ` to paste the selected entry.
14901490
14911491>lua
1492- require("fzf-lua") .fzf_exec({"foo", "bar"}, {complete = true})
1492+ FzfLua .fzf_exec({"foo", "bar"}, {complete = true})
14931493<
14941494Custom completion is possible using a custom completion callback, the example
14951495below will replace the text from the current cursor column with the selected
14961496entry:
14971497
14981498>lua
1499- require("fzf-lua") .fzf_exec({"foo", "bar"}, {
1499+ FzfLua .fzf_exec({"foo", "bar"}, {
15001500 -- @param selected: the selected entry or entries
15011501 -- @param opts: fzf-lua caller/provider options
15021502 -- @param line: originating buffer completed line
0 commit comments