Vifm — Powerful command line file manager

Ali Aref
6 min readOct 2, 2021

--

My Vifm File Manager ~ Ali Aref

Vifm is an ncurses based file manager with vi(m) like keybindings. If you use vi(m), then vifm gives you complete keyboard control over your files without having to learn a new set of commands. You can preform any file management operations(viewing, copying, deleteing, moving) files and folder using vifm. There is not any GUI interface for vifm as we know it’s vi based file manger so for the vi(m) users it’s the best and lovely choices to mange their files.

Installation

The vifm installation is so easy as just running a command! It’s available on most the Linux distributions repositories.

sudo apt install vifm [On Debian/Ubuntu]
sudo pacman -S vifm [On Arch]

Usage

By default vifm start in two splited panels which each of them is representing a directory.

Basic movement between files

  • j, k, h, l
    for moving up, down, parent directory, opening directory of file.
  • Switching between panels
    use tab or space to switch between the panels.
  • Copying a file
    to copy a file press “yy” then to past it in your preferred location press “p”.
    to select multiple files “v” to select the files then “yy” to copy and “p” to paste.
  • Deleting a file
    go on top of the file you want to delete and press “dd”.
  • Moving a file
    to cut the file press “dd” and then to your preferred location press “p”.
  • Searching for files
    press “/” to and type your name regx or any searching terms then press enter. to jump to the next and pervious matched item press “n” and “N”.
  • Renaming
    to rename press “cw” then edit the name and press enter.
  • Scrolling panes
    to scroll to top, center and bottom press “zt”, “zz” and “zb”.
  • Hide and show hidden files and folder
    to toggle visibility of dot files press “za”.
  • Quite the vifm
    to quite the vifm type “:q” and press enter.

Advance Usage

Here are some more options for efficient using vimf. but these are just a drop of vifm sea. for a complete guide you can run either vifm -h or man vifm .
SoO let’s get into it.

Movements
The basic vi key bindings are used to move through the files and pop-up windows.

  • k, gk, or Ctrl-P : move cursor up one line.
  • j, gj or Ctrl-N: move cursor down one line.
  • h when ‘lsview’ is off move up one directory (moves to parent directory node in tree view), otherwise move left one file.
  • l when ‘lsview’ is off move into a directory or launches a file, otherwise move right one file.
  • gg move to the first line of the file list.
  • G move to the last line in the file list.
  • gh go up one directory regardless of view representation (regular, ls-like). Also can be used to leave custom views including tree view.
  • gl or Enter enter directory or launch a file.
  • H move to the first file in the window.
  • M move to the file in the middle of the window.
  • L move to the last file in the window.
  • Ctrl-F or Page Down move forward one page.
  • Ctrl-B or Page Up move back one page.
  • Ctrl-D jump back one half page.
  • Ctrl-U jump forward one half page.
  • n% move to the file that is n percent from the top of the list (for example 25%).
  • 0 or ^ move cursor to the first column. See ‘lsview’ option description.
  • $ move cursor to the last column. See ‘lsview’ option description.
  • Space switch file lists.
  • gt switch to the next tab (wrapping around).
  • {n}gt switch to the tab number {n} (wrapping around).
  • gT switch to the previous tab (wrapping around).
  • {n}gT switch to {n}-th previous tab.

Movement with count, most movement commands also accept a count, as 12j would move down 12 files. Count also could be combined with other movement commands too.

You also scroll top, center and bottom using “zt”, “zz” and “zb” .

The general usage syntax would be as

vifm [OPTION]... 
vifm [OPTION]... path
vifm [OPTION]... path path

Path
Defines the path for Vifm to start, either you can define one or two. while defining a single path vifm starts the first panel where the path is pointed and the other is automatically set as the current view; or you can defining two paths for each of the panels.

Paths to files are also allowed in case you want vifm to start with some archive opened.

Options
vifm starts in the current directory unless it is given a different directory on the command line or ‘vifminfo’ option includes “savedirs” (in which case last
visited directories are used as defaults). Some of these options would be:

  • — select <path>
    Open parent directory of the given path and select specified file in it.
  • -f Makes vifm instead of opening files write selection to $VIFM/vimfiles and quit.
  • — choose-files <path>|-
    Sets output file to write selection into on exit instead of opening files. “-” means standard output. Use empty value to disable it.
  • — choose-dir <path>|-
    Sets output file to write last visited directory into on exit. “-” means standard output. Use empty value to disable it.
  • — delimiter <delimiter>
    Sets separator for list of file paths written out by vifm. Empty value means null character. Default is new line character.
  • — on-choose <command>
    Sets command to be executed on selected files instead of opening them. The command may use any of macros described in “Command macros” section below. The command is executed once for whole selection.
  • -c <command> or +<command>
    Run command-line mode <comand> on startup. Commands in such arguments are executed in the order they appear in command line. Commands with spaces or special symbols must be enclosed in double or single quotes or all special symbols should be escaped (the exact syntax strongly depends on shell). “+
    argument is equivalent to “$” and thus picks last item of of the view.
  • — logging[=<startup log path>]
    Log some operational details $VIFM/log. If the optional startup log path is specified and permissions allow to open it for writing, then logging of
    early initialization (before value of $VIFM is determined) is put there.
  • — server-list
    List available server names and exit.
  • — server-name <name>
    Name of target or this instance (sequential numbers are appended on name conflict).
  • — remote
    Sends the rest of the command line to another instance of vifm, — server-name is treated just like any other argument and should precede — remote on the command line. When there is no server, quits silently. There is no limit on how many arguments can be processed. One can combine — remote with -c <command> or +<command>to execute commands in already running instance of vifm. See also “Client-Server” section below.
  • — remote-expr
    passes expression to vifm server and prints result. See also “Client-Server” section below.
  • — no-configs
    Skip reading vifmrc and vifminfo.

Conclusion

There are much reasons to use vifm. the main one would be the speed!
When ever you want to mange your file with out moving your hands off from the keyboard home row keys and touching the mouse and do things so quick and fast you need to use vifm. actually there are some other alternatives too, as midnight commander(mc), Ranger or nnn and more. but for the vim users the vifm is the best choice then any other out there.
of course there are GUI file manger too, and most of us are using them every day, but the CLI is an other thing :)

--

--

Responses (1)