vifm: A Terminal File Browser for Hardcore Vim Lovers

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

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!

Similar Posts

  • Hello, I had seen this before on youtube channels, but after reading this post, I finally started using it.
    Thanx!

      • I like it, I am also getting used to the hjkl moving ad D or yy in vim and or doomemacs.
        but I haven’t used (yet) the right pane. I would like to have it show me what’s in the directory that is selected on left pane, or a preview of the file that is selected on the left pane. any help/pointers?