Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.
/ cfm Public archive

🌵 Simple and fast TUI file manager with no dependencies.

License

Notifications You must be signed in to change notification settings

willeccles/cfm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cactus File Manager

Cactus File Manager (cfm) is a TUI file manager with the goal of being simple, easy, and bloat-free, utilizing Vi-inspired keybinds. Whether or not you should use it depends on whether or not you like the name, dev, or screenshot, just like with all software.

Note: the screenshot above has a non-default pointer and no alternative views enabled.

Demo showing off deletion, undo, marks, and basic navigation.

Configuration

To configure cfm before building, you should copy config.def.h to config.h and then modify it to suit your needs. Each option is explained within the file. If you build cfm without creating a config, it will create a default one for you.

There are some options which cfm will attempt to use environment variables for. These are $EDITOR, $SHELL, and $OPENER. If you want to specify a specific option just for cfm, it will first try to find these variables prefixed with $CFM_. For example, if your $EDITOR is set to vim but you want to tell cfm to use emacs, you could use export CFM_EDITOR='emacs'. If you installed cfm via a package manager, or if you are using the default configuration, you can specify these environment variables to configure cfm without rebuilding. cfm uses a temporary directory for its deleted files (to enable undo and cut/paste). If it's not set in config.h, then cfm will attempt to use the $CFM_TMP environment variable. If this is not set either, then /tmp/cfmtmp will be used. If a temporary directory is not specified in any way or it cannot create the directory it is attempting to use, cfm will disable undo and cut/paste. If CD_ON_CLOSE is not enabled at compile-time, cfm will look for the $CFM_CD_ON_CLOSE environment variable, which should contain the path to a file where cfm should write its current working directory when quit with Q.

Building

When building from source, you should get the source for the latest release and then run make inside the extracted source.

Installing

From Source

First, download the latest release's source. Then, use sudo make install. You can specify a PREFIX or DESTDIR like with many makefiles. By default, PREFIX is /usr/local/, but if you wish to install into /usr, you can do sudo make install PREFIX=/usr.

With a Package Manager

At the moment, cfm is available from the following sources (not all maintained by me):

Packaging status

Bugs

If you find a bug, please create an issue on GitHub.

Usage

The functions of some keys may be dependent on values set in config.h.

Key(s) Function
q, Esc Quit cfm
Q Quit cfm, saving its working directory to the file specified in CD_ON_CLOSE, if enabled. Disabled by default.
h Go up a directory1
j Move down1
PgDn, J Move down by one full screen
k Move up1
PgUp, K Mode down by one full screen
~ Navigate to user home directory
/ Navigate to the system root directory
l Enter directory, or open file in EDITOR1
dd Delete currently selected file or directory (there is no confirmation, be careful), backing it up to the CFM_TMP directory if one exists, such that it can be undone with u
Alt+dd Works the same as dd, but is always permanent, even if a CFM_TMP directory exists. This is useful for huge files/directories that would take a while to copy. Be careful!
T Creates a new file, opening EDITOR to obtain a filename2
M Creates a new directory, opening EDITOR to obtain a directory name2
R Renames a file, opening EDITOR to edit the filename2
gg Move to top
G Move to bottom
m, Space Mark for deletion
D Delete marked files (does not touch unmarked files)
u Undo the last deletion operation (if cfm was unable to access/create its trash directory ~/.cfmtrash, deletion is permanent and this will not work)
X Cut the current file or directory (to be pasted again with p)
yy Copy the current file or directory (to be pasted again with p)
p Paste the previously copied or cut file or directory
e Open file or directory in EDITOR
o Open file or directory in OPENER
S Spawns a SHELL in the current directory
r Reload directory
. Toggle visibility of hidden files (dotfiles)
Return Works like o if ENTER_OPENS was enabled at compile-time, else works like l
Tab Switches to the next view
` Switches to the previous view
1...0 Switches to view N, up to the number specified by VIEW_COUNT (default 2)

1 The arrow keys work the same as hjkl.

2 The available characters for filenames are A-Za-z ._- by default, which is POSIX "fully portable filenames" plus spaces. If you wish, you can disable spaces by setting ALLOW_SPACES to 0.

Scripting

If stdin or stdout are not attached to a TTY, cfm will read commands from stdin until either EOF is reached or it does not read any more data. This can be used to script operations. All errors will be printed to stderr and are fatal. In scripting mode, cfm will never draw to the screen. Note: in non-interactive mode, cfm will NOT backup files on deletion. This means that you cannot use dd followed by u! All deletions made in non-interactive mode will be final.

Example:

$ cat script.txt
jjljjjkyyhp
$ cfm <script.txt

This example is equivalent to performing the following operations in a normal cfm instance:

  1. Go down twice with j
  2. Go into the currently selected directory with l
  3. Go down three times with j and up once with k
  4. Yank the current file with yy
  5. Go back to the parent directory with h
  6. Paste the yanked file with p