vifm: A Terminal File Browser for Hardcore Vim Lovers

Explore a terminal-based file browser application that can be used with the Vim style key bindings.
Warp Terminal

When it comes to navigating through the Linux directory structure in the command line, people often rely on the cd command.

And nothing wrong with it because you’ll get the cd command on any Linux system you log in.

However, if the system is maintained by you and you want to have a better view of the directories, a file manager does a lot better than the cd or tree command.

Yes, you can get file managers in the terminal as well. They may not be as good as the GUI ones like Nautilus but still better than the plain old commands.

There are several TUI file browsers and we have covered a few of them on It’s FOSS. Today, we look at vifm.

What is vifm?

vifm screenshot

vifm is a command line tool that is a file manager with key bindings for navigation and file system object manipulation that are similar to vim. In case you are wondering what I meant by “file system objects”, they are files, directories, symbolic links, hard links etc.

Along with the very intuitive vim interaction key bindings, below is the set of features that vifm offers you

  • A fast file manager right in your terminal
  • Edit the text file from the file manager itself
  • vifm uses the curses interface
  • vifm is cross platform (can even work on Windows with the help of Cygwin; it should work but I have not tested it)
  • Supports vim style key binding inputs like dd, j, k, h, l etc
  • The vifm plugin is available to be used inside vim for opening file(s) through vim
  • Auto complete support for the vim commands
  • Support for more than one panes
  • Allows batch rename with [or without] regex

Installing vifm on Linux

The vifm package isn’t new and therefore is readily available in even the “stable” distributions’ (like Debian) repositories by default.

On Debian and Debian based distros (like Ubuntu, Pop!_OS, Mint etc), you can use the apt package manager to install vifm:

sudo apt install vifm

Use the pacman package manager to install vifm on Arch-based Linux distributions:

sudo pacman -S vifm

vifm is also available in the Fedora and RHEL repositories; install vifm with the DNF package manager:

sudo dnf install vifm

Once you have vifm installed, you can simply type vifm your terminal – like below – and start vifm

vifm

The vifm user interface

When you launch vifm for the first time, by default, it will launch with the overview of the directory that you are currently in. You will also notice, that vifm uses two panes by default.

01 two panes 1
The default vifm interface, consisting of a normal view (hidden files not visible) and two panes opened by default

If you find yourself confused at the interface, simply try pressing the j key to move the cursor down one row, and press the k key to move the cursor up one row. You can move up one directory by pressing the h key. Just like vim!

If your cursor is currently on a file, pressing the l key will open the file in vim (if not stated otherwise). But if your cursor is on a directory, pressing the l key will navigate in the directory and show you the directory contents.

You can also get details about a file or directory from the file manager by pressing the Ctrl + g key binding.

02 ctrl g info
A screenshot of how the Ctrl – g key binding shows you a directory/file info

You can press the keys “za” to either show files and directories that are hidden (files and directories with a period at beginning are hidden by default). If these special files and directories are not hidden, pressing za will hide them.

03 toggle dotfile visibility
An example of how it will look when you press the “zo” key binding

You can either permanently show hidden files and directories with the “zo” key binding and never make these items visible with the “zm” key binding.

Conclusion

Since it is based on Vim, you can configure it using the vifmrc file. The vifm wiki has the latest default keybinding cheatsheet located here. The project is very well documented.

vifm key binding cheatsheet
Vifm default key binding

vifm is an amazing file manager, specially for Vim users because it integrates so well with the Vim ecosystem. It incorporates many vim features and key bindings into a file manager. The default two-pane layout makes it more productive.

Do not hesitate to give vifm a try. It really is an amazing command line tool!

About the author
Pratham Patel

Pratham Patel

You will find me tinkering with software until my system crashes. And then I keep on writing about my findings.

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

itsfoss happy penguin

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.