fzf integration in ranger

Ranger is advanced file manager (like mc, Nautilus, Total Commander, …) but it uses key bindings and shortcuts like vim. It is in Debian’s repositories.

fzf (command-line fuzzy finder) is tool for searching files and directories. You can download it from github.com/junegunn/fzf

For integration create (or open) file ~/.config/ranger/commands.py and add function fzf_select. All file should looks like this:

from ranger.api.commands import Command

class fzf_select(Command):

    Find a file using fzf.

    With a prefix argument select only directories.

    See: https://github.com/junegunn/fzf
    def execute(self):
        import subprocess
        import os.path
        fzf = self.fm.execute_command("fzf +m", universal_newlines=True, stdout=subprocess.PIPE)
        stdout, stderr = fzf.communicate()
        if fzf.returncode == 0:
            fzf_file = os.path.abspath(stdout.rstrip('\n'))
            if os.path.isdir(fzf_file):

Then restart ranger and type :fzf_select and start using fzf in ranger.

1 thought on “fzf integration in ranger

  1. Pingback: Change prompt in Ranger | posvic.eu

Leave a Reply

Your email address will not be published. Required fields are marked *