Overview
Vifm is a terminal-based file manager that uses Vim keybindings and is implemented in C. It is similar to Ranger, but is more heavily based on Vim.
For documentation see the Manual.
For key bindings see the Cheatsheet.
For color schemes see the Color Schemes.
Installing
See the “Download link” at the bottom of the home page for downloading the source or Windows executables.
To install Vifm in macOS, install Homebrew and enter brew install vifm.
Launching
To start Vifm, enter vifm.
The current directory is identified in the top line. A status bar at the bottom displays information about the file or directory under the cursor. This includes the read/write/execute permissions, owner:group, size, and last modified date and time.
Vifm displays two panes by default that are views of two directories.
This makes it easy to copy and move files between directories.
These directories can be specified as
command-line arguments with vifm is started.
If they are not specified, it starts with
both panes showing the current directory.
However, Vifm remembers the last directory visited in each pane
and restores these in subsequent sessions.
To force starting in the current directory, start with vifm ..
To exit Vifm, enter :q just like quitting Vim.
Help
For help, enter :help or just :h.
To open help and scroll to a specific command, enter :help command.
To exit help, enter :q.
Navigating
| Direction | Keys |
|---|---|
| next item in current directory | j or down arrow |
| previous item in current directory | k or up arrow |
| into child directory | l or right arrow or enter |
| into parent directory | h or left arrow |
To open the item the cursor,
press l, the right arrow, or return.
Text files are displayed in the right column.
Non-text files are opened by their default application.
For example, in macOS image files are opened in the Preview app.
TODO: I tried to configure Nushell to use Preview app for images. TODO: I also tried to configure vifm to use imgcat. TODO: This works iTerm2, but not in tmux. There is issues file for this.
Functionality
To open the file under the cursor, press the return key. Text files are opened in Vim.
Commands
Vifm commands can entered by pressing : which
opens a line at the bottom for typing a command just like in Vim.
Common tasks are described in the table below. The term “item” refers to a file or directory, often the one under the cursor.
| Task | Key Binding | Notes |
|---|---|---|
| bookmark - create | :bmark name | creates bookmark for current directory |
| bookmark - list | :bmarks | bookmark for current directory |
| bookmark - go | :bmgo name | |
| directory - change | :cd path | can use environment variables in path |
| directory - create | :mkdir name | |
| file - create | :touch name | |
| file - edit | enter | :q to quit editing |
| file - view when not in preview mode | e | q or :q to quit viewing |
| help - display | :help | |
| hidden items - hide | zm | |
| hidden items - show | zo | |
| item - copy | yy | for yank |
| item - delete/cut | dd | |
| item - paste | p | after a delete or copy |
| item - rename name and/or extension | cw | |
| item - rename only name | cW | |
| item - toggle selection | t | TODO: How can you operate on selections? |
| item - undo delete | u | |
| mark - create | m followed by letter | remembers selected item in directory |
| mark - delete under cursor in list | dd | |
| mark - go to | ' followed by letter | |
| mark - go to home directory | 'h | uses predefined mark |
| mark - list all | :marks | |
| move - to bottom of pane | G | |
| move - to top of pane | gg | |
| pane - move to other | tab | |
| pane - show only one | :only or ctrl-w o | |
| pane - split horizontal | sp or ctrl-w s | also switches from 1 to 2 panes |
| pane - split vertical | vs or ctrl-w v | also switches from 1 to 2 panes |
| preview mode - toggle | w | changes 2nd pane to show preview of item |
| preview pane - toggle focus | shift-tab | can navigate up and down in preview pane |
| shell - open in current directory | :shell | exit to return to vifm |
Configuring
By default vifm is configured in the file ~/.vifm/vifmrc.
Color Schemes
Vifm provides predefined
color schemes.
To use these, download their .vifm files
into the ~/.config/vifm/colors directory.
Then edit ~/.config/vifm/vifmrc and change the colorscheme setting.
For example, colorscheme desert.
Finally, restart vifm for the change to take effect.
Icons
To display icons before files of specific types
add lines like the following in the vifmrc configuration file
and restart vifm.
Note that file types are surrounded by single colons
and file patterns are surrounded by double colons.
set classify=' :dir:'
set classify+='🏃 :exe:'
set classify+=' :link:' " link
set classify+=' ::*.css::' " CSS
set classify+=' ::*.go::' " Go
set classify+=' ::*.html::' " HTML
set classify+=' ::*.java::' " Java
set classify+=' ::*.js::' " JavaScript
set classify+=' ::*.md::' " Markdown
set classify+=' ::*.py::' " Python
set classify+=' ::*.rb::' " Ruby
set classify+=' ::*.rs::' " Rust
set classify+=' ::*.sass::' " Sass
Questions
How do you copy or delete multiple items as a group? See “item - toggle selection”.
How do you search/grep inside vifm?
How can you use fileviewer to configure
image files to open in the Mac Preview app?