Skip to content

Select Files with FZF is a ZSH plug-in letting you selects files on the command line with fzf and eza

License

Notifications You must be signed in to change notification settings

chmouel/fzf-select-file

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 

Repository files navigation

FZF select file zsh plugin

A simple plugin to let you select some files on the command line with fzf and eza

Install

Using zplug

zplug 'chmouel/fzf-select-file'

Or any ZSH plugin manager (I use this own made one vtplug)

You can as well simply git clone this repository and source the fzf-select-file.plugin.zsh file if you want to do this just manually.

Requirements

You need to have those tools installed:

  • fzf (for selection)
  • eza (for listing)
  • bat (for preview)

Usage

C-x C-f (or control-x followed by control-f) will launch fzf with a listing from eza, you can select one or multiple files (with the tab keys) and it will be added to the command line. If you have a word on the command line it will be used as the initial query for fzf and replaced with the results.

By default it will show the files without the 'hidden' files (the ones starting with a dot) if you want to include them you can use the C-x C-a (or control-x followed by control-a) keybinding to show them.

While in selection it will show a preview with bat for files or eza for directories (may fail on unknown files to bat) press control-v to hide the preview.

Demo

recording-20230911-18h46.mp4

Configuration

You can customize some variables

  • ZSH_FZF_SELECT_FILE_FZF_ARGS: The arguments to fzf.
  • ZSH_FZF_SELECT_FILE_EZA_BINARY: The binary to use for eza, default to eza.
  • ZSH_FZF_SELECT_FILE_EZA_COLORS: The eza colors to use default to da=00.
  • ZSH_FZF_SELECT_FILE_EZA_ARGS: The arguments to eza.
  • ZSH_FZF_SELECT_FILE_BIND: The keybinding to use default to "^x^f".
  • ZSH_FZF_SELECT_ALL_FILES_BIND: The keybinding to use default when selecting all files including the dot files, default to ^x^a.
  • ZSH_FZF_SELECT_FILE_FZF_PREVIEW: The preview shell command (see source for default).

TIPS

If you want to make Control-x Control-f select all you just need to set this in your config file before loading the plugin:

ZSH_FZF_SELECT_ALL_FILES_BIND="^x^f"

Copyright

Apache-2.0

Blog

Authors

Chmouel Boudjnah

Alternative

You can as well use the FZF ZSH Plugin to get everything selected with fzf in zsh but no pretty eza listing in there...

Thanks

About

Select Files with FZF is a ZSH plug-in letting you selects files on the command line with fzf and eza

Topics

Resources

License

Stars

Watchers

Forks

Languages