a Yazi plugin that integrates fzf with bat preview for rg search and
rga preview for rga search
supports: bash, fish, and zsh
- bat
- fzf
- ripgrep
- ripgrep-all (optional)
ya pkg add lpnh/frthis plugin supports two arguments:
-
rg:rgsearchbatpreviewrgmatch (default)fzfmatch (alternative)
-
rga:rgasearchrgapreviewrgamatch
below is an example of how to configure both in the
~/.config/yazi/keymap.toml file:
[[mgr.prepend_keymap]]
on = ["f", "r"]
run = "plugin fr rg"
desc = "Search file by content (rg)"
[[mgr.prepend_keymap]]
on = ["f", "a"]
run = "plugin fr rga"
desc = "Search file by content (rga)"this plugin provides the following custom fzf keybindings:
ctrl-r: reload the searchctrl-s: toggle the matching method (rg, fzf)ctrl-]: toggle the preview window size (66%, 80%)ctrl-\: toggle the preview window position (top, right)
you can customize the default fzf colors using the FZF_DEFAULT_OPTS
environment variable. for an example, check out Catppuccin's fzf
repo
more examples of color themes can be found in the fzf documentation
for those seeking further customization, you can tweak all the integrated tools
used by this plugin in your ~/.config/yazi/init.lua file. simply pass a table
to the setup function with any of the following fields and their respectives
options:
require("fr"):setup({
fzf,
rg,
bat,
rga,
rga_preview,
})all fields are optional and accept either a string or a table of strings containing command-line options.
example:
require("fr"):setup {
fzf = [[--info-command='echo -e "$FZF_INFO 💛"' --no-scrollbar]],
rg = "--colors 'line:fg:red' --colors 'match:style:nobold'",
bat = "--style 'header,grid'",
rga = {
"--follow",
"--hidden",
"--no-ignore",
"--glob",
"'!.git'",
"--glob",
"!'.venv'",
"--glob",
"'!node_modules'",
"--glob",
"'!.history'",
"--glob",
"'!.Rproj.user'",
"--glob",
"'!.ipynb_checkpoints'",
},
rga_preview = {
"--colors 'line:fg:red'"
.. " --colors 'match:fg:blue'"
.. " --colors 'match:bg:black'"
.. " --colors 'match:style:nobold'",
},
}almost everything from interface elements to search filters can be customized — you just need to find the right flag. that's the hard part. lol
@vvatikiotis for the rga
integration
this is a derivative of @DreamMaoMao's fg.yazi plugin. consider using the
original one instead; you can find it at
https://gitee.com/DreamMaoMao/fg.yazi, with a mirror available at
https://github.com/DreamMaoMao/fg.yazi