@@ -115,15 +115,16 @@ Fzf-lua aims to be as plug and play as possible with sane defaults, you can
115115run any fzf-lua command like this:
116116
117117``` lua
118- :lua require (' fzf-lua' ).files ()
119- -- or using the `FzfLua` vim command:
118+ :lua require (" fzf-lua" ).files ()
119+ -- once loaded we can use the global object
120+ :lua FzfLua .files ()
121+ -- or the vim command:
120122:FzfLua files
121123```
122124
123125or with arguments:
124126
125127``` lua
126- -- Once fzf-lua is loaded you can also use the lua global `_G.FzfLua`
127128:lua FzfLua .files ({ cwd = ' ~/.config' })
128129-- or using the `FzfLua` vim command:
129130:FzfLua files cwd = ~/ .config
@@ -412,7 +413,7 @@ Fzf-Lua conveniently comes with a VS-Code like picker by default
412413> to see detailed usage notes and a comprehensive list of yet more(!) available options.
413414
414415``` lua
415- require (" fzf-lua" ).setup {
416+ require (" fzf-lua" ).setup {
416417 -- MISC GLOBAL SETUP OPTIONS, SEE BELOW
417418 -- fzf_bin = ...,
418419 -- each of these options can also be passed as function that return options table
@@ -586,7 +587,6 @@ keymap = {
586587<summary >actions</summary >
587588
588589``` lua
589- local actions = require (" fzf-lua" ).actions
590590actions = {
591591 -- Below are the default actions, setting any value in these tables will override
592592 -- the defaults, to inherit from the defaults change [1] from `false` to `true`
@@ -598,15 +598,15 @@ actions = {
598598 -- `file_edit_or_qf` opens a single selection or sends multiple selection to quickfix
599599 -- replace `enter` with `file_edit` to open all files/bufs whether single or multiple
600600 -- replace `enter` with `file_switch_or_edit` to attempt a switch in current tab first
601- [" enter" ] = actions .file_edit_or_qf ,
602- [" ctrl-s" ] = actions .file_split ,
603- [" ctrl-v" ] = actions .file_vsplit ,
604- [" ctrl-t" ] = actions .file_tabedit ,
605- [" alt-q" ] = actions .file_sel_to_qf ,
606- [" alt-Q" ] = actions .file_sel_to_ll ,
607- [" alt-i" ] = actions .toggle_ignore ,
608- [" alt-h" ] = actions .toggle_hidden ,
609- [" alt-f" ] = actions .toggle_follow ,
601+ [" enter" ] = FzfLua . actions .file_edit_or_qf ,
602+ [" ctrl-s" ] = FzfLua . actions .file_split ,
603+ [" ctrl-v" ] = FzfLua . actions .file_vsplit ,
604+ [" ctrl-t" ] = FzfLua . actions .file_tabedit ,
605+ [" alt-q" ] = FzfLua . actions .file_sel_to_qf ,
606+ [" alt-Q" ] = FzfLua . actions .file_sel_to_ll ,
607+ [" alt-i" ] = FzfLua . actions .toggle_ignore ,
608+ [" alt-h" ] = FzfLua . actions .toggle_hidden ,
609+ [" alt-f" ] = FzfLua . actions .toggle_follow ,
610610 },
611611 }
612612```
@@ -1070,7 +1070,7 @@ previewers = {
10701070 cwd_only = false ,
10711071 stat_file = true , -- verify files exist on disk
10721072 -- can also be a lua function, for example:
1073- -- stat_file = require("fzf-lua") .utils.file_is_readable,
1073+ -- stat_file = FzfLua .utils.file_is_readable,
10741074 -- stat_file = function() return true end,
10751075 include_current_session = false , -- include bufs from current session
10761076 },
@@ -1300,13 +1300,13 @@ previewers = {
13001300 -- by default display all LSP locations
13011301 -- to customize, duplicate table and delete unwanted providers
13021302 providers = {
1303- { " references" , prefix = require ( " fzf-lua " ) .utils .ansi_codes .blue (" ref " ) },
1304- { " definitions" , prefix = require ( " fzf-lua " ) .utils .ansi_codes .green (" def " ) },
1305- { " declarations" , prefix = require ( " fzf-lua " ) .utils .ansi_codes .magenta (" decl" ) },
1306- { " typedefs" , prefix = require ( " fzf-lua " ) .utils .ansi_codes .red (" tdef" ) },
1307- { " implementations" , prefix = require ( " fzf-lua " ) .utils .ansi_codes .green (" impl" ) },
1308- { " incoming_calls" , prefix = require ( " fzf-lua " ) .utils .ansi_codes .cyan (" in " ) },
1309- { " outgoing_calls" , prefix = require ( " fzf-lua " ) .utils .ansi_codes .yellow (" out " ) },
1303+ { " references" , prefix = FzfLua .utils .ansi_codes .blue (" ref " ) },
1304+ { " definitions" , prefix = FzfLua .utils .ansi_codes .green (" def " ) },
1305+ { " declarations" , prefix = FzfLua .utils .ansi_codes .magenta (" decl" ) },
1306+ { " typedefs" , prefix = FzfLua .utils .ansi_codes .red (" tdef" ) },
1307+ { " implementations" , prefix = FzfLua .utils .ansi_codes .green (" impl" ) },
1308+ { " incoming_calls" , prefix = FzfLua .utils .ansi_codes .cyan (" in " ) },
1309+ { " outgoing_calls" , prefix = FzfLua .utils .ansi_codes .yellow (" out " ) },
13101310 },
13111311 }
13121312 },
@@ -1399,13 +1399,13 @@ Using `files` with a different command and working directory:
13991399Using ` live_grep ` with ` git grep ` :
14001400
14011401``` lua
1402- :lua require ' fzf-lua ' .live_grep ({ cmd = " git grep --line-number --column --color=always" })
1402+ :lua FzfLua .live_grep ({ cmd = " git grep --line-number --column --color=always" })
14031403```
14041404
14051405` spell_suggest ` with non-default window size relative to cursor:
14061406
14071407``` lua
1408- :lua require ' fzf-lua ' .spell_suggest ({ winopts = { height = 0.33 , width = 0.33 , relative = " cursor" } })
1408+ :lua FzfLua .spell_suggest ({ winopts = { height = 0.33 , width = 0.33 , relative = " cursor" } })
14091409-- Or via the vimL command
14101410:FzfLua spell_suggest winopts = {height = 0.33 ,width = 0.33 ,relative = cursor }
14111411:FzfLua spell_suggest winopts = {height = 0.33 ,width = 0.33 } winopts .relative = cursor
@@ -1495,7 +1495,7 @@ well as custom completion, for example, set path/completion using `<C-x><C-f>`:
14951495
14961496``` lua
14971497vim .keymap .set ({ " n" , " v" , " i" }, " <C-x><C-f>" ,
1498- function () require ( " fzf-lua " ) .complete_path () end ,
1498+ function () FzfLua .complete_path () end ,
14991499 { silent = true , desc = " Fuzzy complete path" })
15001500```
15011501
@@ -1507,7 +1507,7 @@ Or with a custom command and preview:
15071507``` lua
15081508vim .keymap .set ({ " i" }, " <C-x><C-f>" ,
15091509 function ()
1510- require ( " fzf-lua " ) .complete_file ({
1510+ FzfLua .complete_file ({
15111511 cmd = " rg --files" ,
15121512 winopts = { preview = { hidden = true } }
15131513 })
@@ -1526,14 +1526,14 @@ Every fzf-lua function can be easily converted to a completion function by sendi
15261526> ` p ` to paste the selected entry.
15271527
15281528``` lua
1529- require ( " fzf-lua " ) .fzf_exec ({" foo" , " bar" }, {complete = true })
1529+ FzfLua .fzf_exec ({" foo" , " bar" }, {complete = true })
15301530```
15311531
15321532Custom completion is possible using a custom completion callback, the example below
15331533will replace the text from the current cursor column with the selected entry:
15341534
15351535``` lua
1536- require ( " fzf-lua " ) .fzf_exec ({" foo" , " bar" }, {
1536+ FzfLua .fzf_exec ({" foo" , " bar" }, {
15371537 -- @param selected: the selected entry or entries
15381538 -- @param opts: fzf-lua caller/provider options
15391539 -- @param line: originating buffer completed line
0 commit comments