Specifics - leo-arch/clifm Wiki

CliFM Specifics

Table of contents


Environment

The following variables are read at initialization time:

Variable name Description
CLIFM_FILE_COLORS A colon separated list of file type color codes in the same form specified in the colors section
CLIFM_EXT_COLORS Same as above, but for file extensions
CLIFM_IFACE_COLORS Same as above, but for different elements of ClIFM's interface
CLIFM_FILTER Define a files filter. If set, this variable overrides the Filter option in the configuration file
CLIFM_SUDO_CMD Define the authentication program to use (mostly used to mount an archive or by the prepend-sudo function, by default binded to Alt-v). If not set, defaults to sudo (or doas, if compiled on OpenBSD)

Except when running in stealth mode, CliFM sets the following environment variables:

Variable name Description
CLIFM This variable is set to 1 to let other programs know they were spawned by CliFM
CLIFM_PROFILE This variable is set to the current profile of CliFM (if using two or more instances of CliFM under different profiles, the last one will be used). Specially useful to develop CliFM plugins on a per profile basis
CLIFM_SELFILE The path to the current selection file
CLIFM_BUS This variable contains the path of a pipe by means of which plugins can talk to CliFM. Just write to the pipe and CliFM will hear and handle the message immediately after the plugin's execution. If the message is a path, CliFM will run the open function, changing the current directory to the new path, if a directory, or opening it with the resource opener, if a file. Otherwise, if the message is not a path, it will be taken and executed as a command.

If PromptStyle is set to custom (see the configuration file and its description), the following environment variables are set to the corresponding value, allowing the prompt string itself to handle this information:

Variable name Description
CLIFM_STAT_SEL Current amount of selected files
CLIFM_STAT_TRASH Current amount of trashed files
CLIFM_STAT_MSG Current amount of system messages
CLIFM_STAT_WS Current workspace number
CLIFM_STAT_EXIT Exit code of the last executed command
CLIFM_STAT_ROOT 1 if user is root (UID = 0), 0 otherwise
CLIFM_STAT_STEALTH 1 if running in stealth mode, 0 otherwise

Writing to CLIFM_BUS

echo "/tmp" > "$CLIFM_BUS"

tells CliFM to change the current directory to /tmp

echo "s *.png" > "$CLIFM_BUS"

makes CliFM select all files in the current directory ending with ".png"

The pipe (CLIFM_BUS) is deleted immediately after the execution of its content and recreated before running any other plugin.


Files

NOTE: If $XDG_CONFIG_HOME is not set, $HOME/.config/ is used instead.

CONFIGURATION FILE

The configuration file is $XDG_CONFIG_HOME/clifm/profiles/PROFILE/clifmrc. It will be copied from DATADIR/clifm (usually /usr/share/clifm), and if not found, it will be created anew with default values. In this file you can permanently set up CliFM options, add aliases and some prompt commands. Just recall that in order to use prompt commands you must allow the use of external commands. See the -x command line option and the ext command.

The following is the list of options you'll find in the configuration file:

Option Default value Description
Autocd true If set to true, a command name that is the name of a directory is executed as if it were the argument to the cd command: DIR works just like cd DIR
AutoOpen true If set to true, a command name that is the name of a file is executed as if it were the argument to the open command: FILE works just like open FILE
AutoSuggestions false If set to true, enable the auto-suggestions system. See also the SuggestFiletypeColor and SuggestionStrategy options
ExpandBookmarks false If set to true, expand bookmark names into the corresponding bookmark path: if the bookmark is name=/path, name will be interpreted as /path. TAB completion is also available for bookmark names
CaseSensitiveList false Enable case sensitive listing for files in the current directory
CaseSensitiveDirJump false Enable case sensitive lookup for the directory jumper function (via the j command)
CaseSensitivePathComp false Enable case sensitive completion for file names
CdListsAutomatically true Should files be listed automatically when changing to a directory?
CdOnQuit false Write the last visited directory to $XDG_CONFIG_HOME/clifm/.last to be later accessed by the corresponding shell function at program exit
Classify true If running with colors, append directory indicator and files counter to directories. If running without colors (via the --no-colors command line option), append file type indicator at the end of file names.1 Bear in mind that when running in light mode the check for executable files won't be performed, and thereby no indicator will be added to executable files
ClearScreen true If set to true, clear the screen before listing files
ColorScheme default Color schemes are stored in the colors directory. By default, the default color scheme is used. Visit https://github.com/leo-arch/clifm-colors to get a few more
cpCmd 0 Set the default copy command. Available options are: 0 = cp, 1 = advcp, and 2 = wcp. Both 1 and 2 add a progress bar to cp
DividingLineChar - (a dash) The string used to construct the line dividing the list of files and the prompt (see the interface section). For a detailed explanation consult the prompt section
DirhistMap false If set to true, print a map of the current position in the directory history list, showing previous, current, and next entries
DiskUsage false Print the disk usage of the file system the current directory belongs to
ExternalCommands true Should CliFM be allowed to run external, shell commands?
FilesCounter true The amount of files contained by a directory is informed next to the directory name (see the interface section). However, this feature might slow things down when, for example, listing files on a remote server. The files counter can be disabled here, via the --no-files-counter option, or using the fc command while in the program itself
Filter No filter Use a regular expression to filter file names when listing files. Example: !.*~$ to exclude backup files (ending with ~), or ^\. to list only hidden files. Do not quote the regular expression
Icons false Enable/disable icons
LightMode false Enable the light mode to get some extra performance. See the speed and performance section for details
ListFoldersFirst true Whether to list directories first or not
LongViewMode false List files properties next to file names instead of just file names
LogCmds false Keep a record of both external commands and internal commands able to modify the files system (e.g. r, c, m, and so on)
MaxDirhist 100 Maximum amount of visited directories to remember
MaxHistory 1000 Maximum amount of commands to remember
MaxLog 500 Maximum amount of logs to keep
MaxPrintSelfiles 0 See description for PrintSelfiles below
mvCmd 0 Set the default command to move files. Available options are: 0 = mv, and 1 = advmv. 1 adds a progress bar to mv
MaxJumpTotalRank 100000 When the sum of all ranks in the jump database reaches MaxJumpTotalRank, all ranks will be reduced 10%, and those falling below MinJumpRank will be deleted (exception made of directories in workspaces, bookmarked and pinned directories)
MaxPath 40 MaxPath is only used for the /p option of the prompt: the current working directory will be abbreviated to its basename (everything after last slash) whenever the current path is longer than MaxPath
MinFilenameTrim 20 Minimum length at which a file name can be trimmed in long view mode (including ELN length and spaces)
MinJumpRank 10 When a directory rank in the jump database falls below MinJumpRank, it will be forgotten (exception made of directories in workspaces, bookmarked and pinned directories)
Opener Choose the resource opener to open files with their default associated application. If not set, Lira, CliFM's built-in opener, is used
Pager false Enable Mas, the files list pager
PrintSelfiles false If set to true, always print the list of selected files. Since this list could become quite extensive, you can limit the number of printed entries using the MaxPrintSelfiles option (-1 = no limit, 0 = auto (never print more than half terminal height), or any custom value)
Prompt "\[\e[0;37m\][\[\e[0;36m\]\S\[\e[0;37m\]]\l \A \u:\H \[\e[00;36m\]\w\n\[\e[0;37m\]\z\[\e[0;34m\] \$\[\e[0m\] " For details see the prompt section
PromptStyle default If set to default, CliFM state information such as selected and trashed files, system messages, user ID, and stealth mode, are automatically printed to the left of the prompt. If set to custom, by contrast, this information is stored in environment variables to let the prompt string itself handle it. Setting this option to custom is mostly useful to build highly customized prompts
RestoreLastPath false If set to true, start CliFM in the last visited directory (and in the last used workspace). This option overrides StartingPath
RlEditMode 1 Set readline editing mode: 0 for vi and 1 for emacs
ShareSelbox false Should the Selection Box be shared among different profiles?
ShowHiddenFiles false
Sort 1 Choose sorting method. Only numbers are allowed
SortReverse false By default, CliFM sorts files from less to more (ex: from 'a' to 'z' if using the name method). To invert this ordering, set SortReverse to true (you can also use the --sort-reverse command line option or the st command)
SplashScreen false Print CliFM's logo screen at startup
StartingPath Current working directory Specify CliFM's starting path. This option is overridden by RestoreLastPath
Suggestions false Enable auto-suggestions
SuggestFiletypeColor false It set to true, suggest file names using the corresponding file type color (as specified in the color scheme file) instead of the default one (defined by the sf code in the color scheme file). See the suggestions page
SuggestionStrategy ehfjbac A list of checks to be performed when looking for possible suggestions. See the suggestions page
SyntaxHighlighting false Enable/disable syntax highlighting
TabCompletionMode standard The method used to display possible completions. Available options: standard and fzf. Consult the TAB completion section
TerminalCmd 'xterm -e' Only used when opening a directory via a new CliFM instance (with the x command), this option specifies the command to be used to launch a terminal emulator to run CliFM on it
Tips true Print a usage tip at startup
TrashAsRm false If set to true, the r command executes trash (see the Trashing files page) instead of the rm shell command to prevent accidental deletions
Unicode true Whether to be Unicode aware or not. If using a 100% ASCII setup (e.g. English), you can turn this off
WarningPrompt false A warning prompt to warn the user about invalid command names. This feature depends on Suggestions
WarningPromptStr "(!) > " The string to be used by the warning prompt
WelcomeMessage true Print a welcome message at program startup

1 List of file type indicators:

Indicator File type
/ Directories
@ Symbolic links
= Sockets
| FIFO/pipes
* Executable files
? Unknown file types

PROFILE FILE

The profile file is $XDG_CONFIG_HOME/clifm/profiles/PROFILE/profile.cfm. In this file you can add those commands you want to be executed at startup, even before files listing. You can also permanently set here some custom variables. For instance:

dir="/path/to/folder"

This variable may be used as a shortcut to the specified folder, for instance: cd $dir.

Custom variables could also be temporarily defined via the command prompt:

[email protected] ~ $ var="This is a test"

These temporary variables, unlike those defined in the profile file, will be removed at program exit.

KEYBINDINGS FILE

The keybindings file is $XDG_CONFIG_HOME/clifm/keybindings.cfm. It will be copied from DATADIR/clifm (usually /usr/share/clifm), and if not found, it will be created anew with default values. This file is used to specify the keyboard shortcuts used for some ClifM's functions. The format for each keybinding is always keyseq:function, where keyseq is an escape sequence in GNU emacs style. A more detailed explanation can be found in the keybindings file itself.

PLUGINS DIRECTORY

The directory used to store programs or scripts pointed to by actions (in other words, plugins) is DATADIR/clifm/plugins (usually /usr/share/clifm/plugins). To modify one of these plugins, copy the corresponding plugin to the local plugins directory ($XDG_CONFIG_HOME/clifm/plugins) and edit it to your liking. This local plugins directory takes precedence over the system-wide one.

COLORS DIRECTORY

This directory, DATADIR/clifm/colors (usually /usr/share/clifm/colors), contains available color schemes as files with a .cfm extension. You can create as many color schemes as you want by just dropping them in this directory. The default color scheme file (default.cfm) could be used as a guide. Color schemes could be copied to $XDG_CONFIG_HOME/clifm/colors: this local directory takes precedence over the system-wide one.

ACTIONS FILE

The file used to define custom actions is $XDG_CONFIG_HOME/clifm/profiles/PROFILE/actions.cfm. It will be copied from DATADIR/clifm (usually /usr/share/clifm), and if not found, it will be created anew with default values.

MIMELIST FILE

The mime list file is $XDG_CONFIG_HOME/clifm/profiles/PROFILE/mimelist.cfm. It will be copied from DATADIR/clifm (usually /usr/share/clifm). This file, used by Lira, is just a list of file types and file extensions and their associated applications. Regular expressions are allowed.

BOOKMARKS FILE

The bookmarks file is $XDG_CONFIG_HOME/clifm/profiles/PROFILE/bookmarks.cfm. Just the list of the user's bookmarks used by the bookmarks function.

HISTORY FILE

The history file is $XDG_CONFIG_HOME/clifm/profiles/PROFILE/history.cfm. A list of commands entered by the user and used by the history function.

COMMANDS LOG FILE

The commands logs file is $XDG_CONFIG_HOME/clifm/profiles/PROFILE/log.cfm. For more information see the log command.

MESSAGES LOG FILE

The messages log file is $XDG_CONFIG_HOME/clifm/profiles/PROFILE/messages.cfm. A file containing a list of system messages, either errors, warnings, or simple notices. The messages log format is: [date] message.

KANGAROO'S DATABASE

The directory jumper database is stored in $XDG_CONFIG_HOME/clifm/profiles/PROFILE/jump.cfm.


Kangaroo's Frecency Algorithm

The database

Kangaroo, the directory jumper (invoked via the j command), is designed to learn the navigation habits of the user. The information is stored in a database used to get the best match for a given string provided by the user. In this sense, Kangaroo is like a quick, smart, and evolved cd function.

The information stored in the database, always per directory, is:

a) Number of visits
b) Date of first visit (seconds since the Unix epoch)
c) Date of the last visit
d) The full path of each visited directory

With this information it is possible to construct a ranking of directories to offer the user the most accurate matches for each query string. The matching algorithm takes into account mainly two factors: frequency and recency (which is why this kind of algorithm is often called a frecency algorithm).

After getting an initial list of matches based on the query string(s) entered by the user, the frecency algorithm is applied on each entry in the list. The algorithm is quite simple: (visits * 100) / days-since-first-visit. As a result, we get the average of visits per day since the day of the first visit (what we call the directory rank).

Credits

There are however some further steps in the ranking process: Bonus points.

Extra credits or penalties are assigned based on the directories last access time according to the following simple algorithms:

Lapse Algorithm
Within last hour rank * 4
Within last day rank * 2
Within last week rank / 2
More than a week rank / 4

If the last query string matches the basename of a directory, the entry for this directory gets 300 extra credits. This is done simply because we normally use directory basenames as query strings: they are easier to remember.

In the same way, pinned directories get 1000 extra credits, bookmarked directories 500 credits, and directories currently in a workspace 300 credits.

For example: if the query string is test, /media/data/test will be matched. Now, if this directory was accessed within the last hour, and its rank was 200, it becomes 800. But, because the search string matches its basename, it gets 300 extra credits, and, if this directory is in addition bookmarked and pinned, it gets 1500 extra credits. In this way the total rank of this directory in the matching process is 2600. In doing this, we have more chances of matching what the user actually wanted to match.

Once all entries in the initial list of matches have been filtered via the above procedure and ranked, we can return the best ranked entry. The higher rank a directory has, the more priority it has over the remaining entries in the initial list of matches.

Shrinking the database

Automatic maintenance is done on the database applying two simple procedures:

a) Each entry in the database is checked at startup to remove non-existent directories.

b) Once the sum total of ranks reaches MaxJumpTotalRank (by default 100000), each individual rank is divided by a dynamic factor so that the total rank becomes less than or equal to MaxJumpTotalRank. If some directory rank falls in the process below MinJumpRank (by default 10), the directory is removed from the database.

Both MinJumpRank and MaxJumpTotalRank can be modified in the configuration file. The higher the value of MaxJumpTotalRank, the more time directories will be kept in the database. By contrast, the higher the value of MinJumpRank, the quicker directories will be removed from the database.

Note: Directories visited in the last 24 hours, just as bookmarked/pinned directories, and current directories in one or more workspaces, will not be removed from the database, no matter what their rank is. This is why the total rank could be higher than MaxJumpTotalRank and nonetheless no entry in the database gets deleted.

Note 2: The idea of frecency was, as far as I know, first devised and designed by Mozilla. See https://wiki.mozilla.org/User:Mconnor/Past/PlacesFrecency. However, it is also implemented, though using different algorithms, by different projects like autojump, z.lua, and zoxide.


Resource opener

Lira is CliFM's built-in resource opener, and is controlled via the mime command. File associations are stored in the MIME list file (see the files section).

When running for the first time, or whenever the MIME list file cannot be found, CliFM will copy the MIME definitions file from the DATADIR system directory (usually /usr/share/clifm/mimelist.cfm). This file follows a few simple syntax rules:

Each line in the MIME list file consists of:

a) X or !X, to specify either a graphical or a non-graphical environment respectively.

b) A left value, containing either a file extension or a MIME type to be matched. Regular expressions are supported;

c) A right value, a list of semicolon separated commands (and optionally the commands parameters) to be associated to the corresponding left value. You can use the %f placeholder to specify the position of the file name to be executed in the command, for example: mpv %f --terminal=no. If the placeholder is not specified, the file name will be added to the end of the command.

Note that the syntax departs here from the FreeDesktop specification in that Lira does not rely on desktop files (mostly used by desktop environments), but rather on commands and parameters. In general thus, the syntax is this:

X:MIME=CMD [ARGS] [%f];CMD [ARGS] [%f]; ...

or, for file extensions:

X:E:EXT=CMD [ARGS] [%f];CMD [ARGS] [%f]; ...

To specify applications for non-graphical environments, negate X as follows:

!X:E:EXT=CMD [ARGS] [%f];CMD [ARGS] [%f]; ...

Examples:

Match single extension:

X:E:^txt$:leafpad;mousepad;kate;gedit
!X:E:^txt$:nano;vim;vi;emacs

Note the E character: it indicates that this rule is intended to match a file extension and not a MIME type, just as X means that this rule applies to graphical environments, and !X that it applies to non-graphical environments only.

Match multiple extensions:

X:E:^(sh|c|py|pl)$:geany;leafpad;nano

Match single mimetype:

X:^audio/mp3$=mpv %f --terminal=no;ffplay -nodisp -autoexit;mpv;mplayer

Match multiple mimetypes:

X:^audio/.*=mpv %f --terminal=no;mplayer;mplayer2;vlc;gmplayer;smplayer;totem

In case of MIME types, you can also write the entire expression without relying on any regular expression. For example:

X:text/plain=nano

Lira will check the file line by line, and if a matching line is found, and if at least one of the specified applications exists, this application will be used to open the corresponding associated file. Else, the next line will be checked. In other words, the precedence order is top to bottom (for lines) and left to right (for applications).


Expansions, completions, and suggestions

TAB completion

CliFM provides two TAB completion modes: standard and fzf.

Standard mode

stdtabcomp

FZF mode

stdtabcomp

To enable the fzf mode, which depends on FZF, start CliFM with the --fzftab command line option or set TabCompletionMode to fzf in the configuration file.

Besides the default TAB completion for command names and paths, you can also expand ELN's using the TAB key. For example:

s 12 -> TAB -> s filename (or, if 12 refers to a directory, s dir/)

CliFM uses a Bash-style quoting system, so that this file name: this is a [email protected]{1} is expanded as follows: this\ is\ a\ test\@version\{1\}

TAB completion for bookmarks, color schemes, profiles, sort method, and directory history (via the j command) is also available. To make use of the bookmarks completion, make sure to specify some name for your bookmarks, since these names are used by the completion function.

By default, path completion via the TAB key is performed ignoring case. To change this behavior, set CaseSensPathComp to true in the configuration file, or run CliFM using the --case-sens-path-comp command line option.

The sel keyword

CliFM will automatically expand the sel keyword: sel indeed amounts to file1 file2 file3 .... In this way, you can use the sel keyword with any command.

If you want to set the executable bit on several files, for instance, simply select the files you want and then run this command: chmod +x sel. Or, if you want to copy or move several files into some directory: c sel 12, or m sel 12 (provided the ELN 12 corresponds to a directory), respectively.

If the destiny directory is omitted, selected files are copied into the current working directory, that is to say, m sel amounts to m sel ..

To trash or remove selected files, simply run t sel or r sel respectively.

The same goes for wildcards and braces: chmod +x *, for example, will set the executable bit on all files (excluding hidden files) in the current working directory, while chmod +x file{1,2,3} will do it for file1, file2, and file3 respectively.

ELN ranges

ELN's and ELN ranges will be also automatically expanded, provided the corresponding ELN's actually exist, that is to say, provided some file name is listed on the screen under those numbers.

For example: diff 1 118 will only expand 1, but not 118, if there is no ELN 118.

In the same way, the range 1-118 will only be expanded provided there are 118 or more entries listed on the screen.

If this feature somehow conflicts with the command you want to run, say, chmod 644 ..., because the current amount of files is equal or larger than 644 (in which case CliFM will expand that number), then you can simply run the command as external: ;chmod 644...

Of course, combinations of all these features is also possible. Example: c sel file* 2 23-31 will copy all selected files, plus all files whose name starts with "file", plus those files corresponding to the ELN's 2, and 23 to 31, into the current working directory.

Auto-suggestions

Gemini is a built-in auto-suggestions system (similar to the one provided by the Fish shell). As you type, Gemini will suggest already used commands, internal parameters (fixed and non-fixed parameters like profiles, color schemes, and remotes names), file names, visited directories, bookmarks, aliases, and programs in your PATH.

The white text before the cursor is what is actually typed so far, while the text after the cursor (here printed in a dimmed magenta color), is the suggested text.

To accept the entire suggestion just press Right or Ctrl-f (otherwise, keep typing and the suggestion will be ignored). The whole line will turn white (or whatever is the color you use for the text typed in the command line) and the cursor will be moved to the end of the line. Then you can press Enter as usual to execute the suggested command.

To accept the first suggested word only (up to first slash or space), press Alt-Right or Alt-f.

When looking for suggestions, Gemini will perform one or more of the following checks:

Description When
1 CliFM commands and parameters (including the sel keyword)3 First word for commands and second or more for parameters
2 Entries in the commands history list (already used commands) First word
3 File names in the current working directory Always1
4 Directories in the jump database Always1
5 Possible completions Always1
6 Program names in PATH3 First word
7 Shell builtins2 3 First word
8 Aliases names Always
9 Bookmarks names Always
10 ELN's Always

1 Only provided autocd (for directories) and/or auto-open functions are enabled (default). Otherwise, the checks are made only for the second or more words.

2 The shell name is taken from /bin/sh. The following shells are supported: bash, dash, fish, ksh, tcsh, and zsh.

3 Command names are checked in the following order: CliFM internal commands, command names in PATH, shell builtins.

Bear in mind that suggestions for ELN's, aliases and bookmarks names, and the jump function do not work as the remaining suggestions: they do not suggest possible completions for the current input string, but rather the value pointed to by it. For example, in the following image, the string 4 is said to point to .github because the current list of files includes a file named .github whose ELN is 4.

When accepting the suggestion (by pressing Right or Ctrl-f), the string typed so far will be replaced by the corresponding suggestion.

Suggestion checks order

The order of these checks could be customized via the SuggestionStrategy option in the configuration file. Each check is assigned a lowercase letter:

Letter Check
a Aliases names
b Bookmarks names
c Possible completions
e ELN's
f Files in the current directory
h Commands history
j The directory jumper database
- Skip a check

The value taken by SuggestionStrategy is a string of seven characters containing the above letters. The letters order in this string specifies the order in which the suggestion checks will be performed. For example, to perform all checks in the same order above, the value of the string should be abcefhj (without quotes). Or, if you prefer to run the history check first: habcefj. Finally, you can ignore one or more checks using a dash (-). So, to ignore the bookmarks and aliases checks, set SuggestionStrategy to h--cefj. The default value for this option is ehfjbac.

Note: The check for program names in PATH is always executed at last, except when the ExternalCommands option (see also the --no-ext command line option or the ext command) is disabled, in which case suggestions for them are simply not displayed.

Suggestions color

The color of the suggested string could be customized in the color schemes file using the appropriate codes:

Code Description Default color
sh Command history suggestions (2 above) 02;35 (dimmed magenta)
sf Bookmarks, file and directory names suggestions (3-5, and 8-9 above) 02;04;36 (dimmed underlined cyan)1
sc Aliases and commands suggestions (program names in PATH) (6 above) 02;31 (dimmed red)
sx Suggestions for CliFM internal commands and parameters (1 above) 02;32 (dimmed green)
mi Greater-than sign (>) used when suggesting ELN's, bookmarks and aliases names 02;31 (dimmed red)

1 You can set SuggestFiletypeColor to true in the configuration file to suggest file names using the corresponding file type color instead of the generic one defined by the sf code. This applies to checks 3-5 and 8-9 above.

The warning prompt

The suggestions system includes a secondary, warning prompt, used to highlight wrong/invalid/non-existent command names. Once an invalid command was entered, the regular prompt will be switched to the warning prompt and the whole input line will turn dimmed red (default color).

The wrong command name check is omitted if the input string:

You can enable the warning prompt using the --warn-wrong-cmd command line option or setting the WarningPrompt option to true in the configuration file.

Both the content of this prompt and its color could be customized. To use a custom warning prompt just modify the WarningPromptStr line in the configuration file (defaults to (!) > ). To use a different color edit the wp value in the current color scheme file (defaults to 02;31 (dimmed red)).

Known issues

Suggestions won't work on the default FreeBSD console (vt, AKA Newcons), since it does not support ECMA-48 status report commands, necessary to get the current cursor position to print suggestions. As a workaround, you can switch to the sc console (AKA syscons), which does support ECMA-48 commands. Edit /boot/loader.conf and set kern.vty to sc:

kern.vty="sc"

You might need to reboot the computer for changes to take effect.

Now, set CLIFM_FREEBSD_CONSOLE_SC environment variable to 1 and run CliFM:

export CLIFM_FREEBSD_CONSOLE_SC=1 && clifm

However, there are two drawbacks with this workaround:

  1. X won't work
  2. Alt keybindings won't work either. To fix this issue consult the Keybindings issues section.

Syntax highlighting

CliFM provides syntax highlighting for the following cases:

Element Default color Color code
Brackets (()[]{}) cyan (00;36) hb
Expansion chars (~*) cyan (00;36) he
Comments (starting with #) dimmed red (02;31) hc
Numbers magenta (00;35) hn
Option parameters (starting with -) cyan (00;36) hp
Process separators (;|&) green (00;32) hs
Quoted strings (' and ") yellow (00;33) hq
Slashes cyan (00;36) hd
Stream redirection (>) red (00;31) hr
Variable names (preceded by $) green (00;32) hv

Highlighting colors could be customized editing the corresponding color code in the InterfaceColors section of the current color scheme file. For example, to get quoted strings highlighted in bold green:

... hq=01;32 ...

To edit the color scheme file just press F8 or enter cs edit.

By default, syntax highlighting is disabled. To enable it, you can either set SyntaxHighlighting to true in the configuration file (F10), or run CliFM with the --highlight command line option.


Actions

Actions are just names given to specific plugins, so that we only need to run this "name" just as if it were any other command. So, supposing the action ab is linked to the plugin ab.sh, you only need to enter ab in order to execute ab.sh.

To list currently available plugins and associated action names, just enter actions.

For more information about actions and plugins, see the plugins section.


Workspaces

Note: The above image shows CliFM running in the second workspace ([2])

CliFM supports up to eight workspaces (also known as tabs). Each workspace has its own persistent path (or current directory), though everything else, like profile, settings, and selected files, is shared among workspaces. Workspaces allows the user to easily switch between the most used directories: do one thing in a workspace and then switch to a second or third one to continue working.

To switch between workspaces you can use the ws command or press Alt-[1-4]. For example, to switch to workspace 3:

ws3

or

Alt-3

You can also select your starting workspace via command line parameters using the -w, --workspace option. This option could be used in combination with positional parameters to set the starting path as well. So, to start in /etc in the workspace 4, run CliFM as follows:

clifm -w4 /etc

By default, the prompt shows the current workspace number enclosed in square brackets, as shown in interface description image.

Each workspace path is stored in $XDG_CONFIG_HOME/clifm/profiles/PROFILE/.last, so that workspaces paths are persistent across CliFM runs.

When switching to a new, empty workspace, the current working directory is used as the new workspace path.


Profiles

A profile is an independent and isolated set of settings for CliFM. Though by default all new profiles are created with the default settings, each profile may have its own color color scheme (useful to clearly distinguish among profiles), its own command and directory history, files and interface settings, and so on.

There is no limit for the number of existent profiles.

Profile data is stored in $XDG_CONFIG_HOME/clifm/profiles/PROFILE.

Creating profiles

To create a new profile you can start CliFM with the -P, --profile option, specifying the profile name (for instance: clifm -P new_profile), or using the pf command as follows:

pf add new_profile

Switching profiles

To switch between profiles while running CliFM, issue this command:

pf set my_profile

You can also use Ctrl-Atl-o and Ctrl-Atl-p to switch to the previous and next profile respectively.

Deleting a profile

To delete a profile, use, again, the pf command:

pf del my_profile

NOTE: TAB completion is available for profile names.

Light mode

In default or normal mode, fstatat(3) is used to gather information about listed files. Since this function, especially when executed hundreds (and even thousands) of times, is quite time consuming, the light mode1 was implemented as an alternative listing process omitting all calls to this function. Compared to the normal mode, CliFM in light mode list files 40% faster.2

Note: When running in light mode, however, only basic file classification is performed, namely, that provided by the d_type field of a dirent struct (see readdir(3)), so that we cannot know in advance if a file is readable by the current user, if it is executable, if it has capabilities, if it is SUID, SGID, if a symlink is broken, and so on. The file extension check is ignored as well, so that the color per extension feature is disabled.

Note 2: Bear in mind, however, that in case of d_type returning a value of DT_UNKNOWN, CliFM will fall back to stat(3) to get basic file classification: we might be facing a file system not returning the d_type value (in which case DT_UNKNOWN is returned for all file types), for example, loop devices.

1 Enable the light mode using the -y, --light-mode command line option, the LightMode option in the configuration file or the lm command.

2 For more performance information consult the statistics section.

Stealth mode

CliFM's commitment to privacy and anonymity is reflected not only in the complete lack of spying and anti-privacy features in the source code (no data collection at all), but also via the so called Stealth mode. When running in stealth mode indeed no file read, just as no file is written to the filesystem: CliFM run's entirely in memory, so that no trace of your presence is left on the host system (besides whatever remains in memory itself).

Because no file is read, options and settings are set to the default values. However, this does not mean that customization isn't possible in stealth mode. In fact, command line options and several environment variables have been implemented to make this possible.

There is however one drawback: Since no file is read, all those features depending on files will not be available in stealth mode. Among these features we find: permanent directory history and files selection, just as bookmarks, the jump database, trashing, logging, etc.

To start CliFM in stealth mode use the -S, --stealth-mode command line option.

An uppercase s (by default bold blue) at the left of the prompt indicates that you are running in stealth mode.