SFF(1)

NAME
sff - simple and fast terminal file manager

SYNOPSIS
sff [-Hchmv] [-d keys] [path]

DESCRIPTION
sff (simple file finder) is a simple, fast, and feature-rich terminal file manager inspired by nnn and guided by the suckless philosophy. It consists of two parts: a core program and an extension script. The core program is designed as a pure file browser and selector with minimal built-in functionality. All file operations, such as copying, moving, and deleting, are implemented by the extension script. For more details, see the EXTENSION SCRIPT section.

sff opens the current working directory if path is not specified.

OPTIONS
The following options are available:

-c  Enable case sensitivity when sorting by filename.

-d keys
    Specify the details to show by default. Valid keys include:

    t Time o Owner and group p Permissions s Size n No details

-H  Show hidden files.

-h  Display program help and exit.

-m  Mix directories and files when sorting.

-v  Print version information and exit.

KEY BINDINGS
Press '?' or 'F1' in sff to see the list of key bindings for built-in functions.

Press Alt+'/' in sff to see the list of key bindings for extension functions and plugins.

CONFIGURATION
sff does not use a runtime configuration file. To customize sff, you need to edit config.h and recompile the program. config.h is a C header file included by the main source file. It defines default settings, key bindings for built-in functions, and colors.

EXTENSION SCRIPT
Extension functions are provided by a POSIX-compliant shell script named sff-extfunc, installed by default in /usr/lib/sff or /usr/local/lib/sff.

You can easily customize key bindings for extension functions and plugins, modify existing functions, or add your own functions by editing this file. It is not recommended to modify the system-wide sff-extfunc directly. Instead, copy it to the user's config directory and edit it there.

The user's config directory is required for executing extension functions. This directory is $XDG_CONFIG_HOME/sff if that variable is set; otherwise, it is $HOME/.config/sff. If the directory does not exist, the program attempts to create it when an extension function is invoked.

During initialization, sff determines the location of sff-extfunc by checking the following directories in order, and uses the first occurrence found:

1. The user's config directory 2. The directory containing the currently running sff executable 3. /usr/local/lib/sff 4. /usr/lib/sff

TABS
Tab status is displayed in the top-left corner of the screen. Five tab indicators are shown, with the current tab highlighted in reverse video. Tabs 1-4 are regular tabs, indicated by '*' when inactive. When switching to an inactive tab, the new tab will be activated and start in the current directory. Tab 5 is a special tab, indicated by '#', dedicated to search results.

SELECTION
Selected file names are highlighted in reverse video. By default, the file under the cursor is automatically selected. When the user performs a selection operation, the program enters manual selection mode, and the file under the cursor is no longer auto-selected. Clearing all selections exits manual mode, returning to the default state.

sff allows file selection across directories. Each tab maintains its own independent selection state. The second set of numbers in the bottom status bar (highlighted in reverse video) indicates the total number of selected files in the current tab.

When an extension function requests selected files, their absolute paths are delivered via a FIFO.

FILTERS
Filters are strings used to dynamically list matching files in the current directory. When a filter is enabled, it appears above the bottom status bar, and the program enters input mode. In this mode, you can perform the following actions:

- Enter a filter string (matching is case-insensitive).

- Use the Up and Down arrow keys to move the cursor.

- Press Enter or Esc to exit input mode while keeping the filter active.

- Press '/' to disable the filter.

The filter applies only to the current directory and is automatically disabled when you navigate to a different directory.

QUICK FIND
Quick find is used to quickly locate a file within the current directory. When enabled, it appears above the bottom status bar, and the program enters input mode. In this mode, you can perform the following actions:

- Enter a search string to match filenames.

- Enter '/' as the first character to jump to root directory.

- Press Tab to enter the directory under the cursor and clear the search string.

- Press the Left arrow key to go to the parent directory.

- Use the Up and Down arrow keys to move the cursor.

- Press Enter or Esc to disable quick find.

Matching is case-insensitive, prioritizing matches at the beginning of filenames. If none start with the search string, it matches filenames containing the string. Upon match, the cursor jumps to the first match.

ADVANCED SEARCH
Advanced search is an extension function based on the find(1) command. It requires two inputs:

1. Filename pattern: This is passed to the -name option of the find command. Wildcards should be used when appropriate. For example, to search for files containing 'lib' in their name, enter '*lib*' rather than 'lib'. If you do not want to search by filename, enter '*' to match all files.

2. Additional search options: More find options may be provided here, such as '-size +4k' to search for files larger than 4KB. Leave this field blank and press Enter if not needed.

After both inputs are provided, the executed command will be:

find ./ input2 -name "input1"

Search results are sent back to sff and listed in tab 5 for further processing.

UNDO AND REDO
sff supports undoing or redoing the last file operation. Supported operations include:

- Create new file - Copy-paste (only if no destination file conflicts) - Cut-paste (only if no destination file conflicts) - Rename - Duplicate

Undo/redo actions apply across different tabs and even different sff instances. A file operation performed in one sff instance can be undone or redone in another instance.

SUDO MODE
In this mode, the status bar text is displayed in red.

When sff is run as a regular user and switched to sudo mode, the command specified by the SFF_SUDOER environment variable (default is sudo) is used to execute all extension functions and plugins with superuser privileges, while built-in functions continue to execute with the original user's privileges, as the main program itself is not elevated.

When sff is run as root, it always runs in sudo mode until termination, and all operations are performed with superuser privileges.

PLUGINS
Plugins are shell scripts used to extend functionality. They are invoked by the extension script, which also sets their keybindings. By default, plugins are installed in /usr/lib/sff/plugins or /usr/local/lib/sff/plugins.

Plugin authors should include detailed usage information as comments at the beginning of the script. To view it, inspect the plugin file directly.

If you wish to modify or add plugins, it is recommended to do so in the plugins directory within the user's config directory. For details on the user's config directory, see the EXTENSION SCRIPT section. When the extension script invokes a plugin, it searches for the plugin in the following locations in order and uses the first match found:

1. The plugins directory in the user's config directory 2. The plugins directory alongside the currently running extension script 3. /usr/local/lib/sff/plugins 4. /usr/lib/sff/plugins

ENVIRONMENT
EDITOR The default text editor. If not set, vi is used.

HOME The home directory used by the program. If not set, / is used.

XDG_CONFIG_HOME User configuration directory. If not set, $HOME/.config is used.

SFF_OPENER The default file opener. If not set, xdg-open is used.

SFF_SUDOER The command invoked for sudo mode. If not set, sudo is used.

AUTHORS
Shi Yanling <sylphenix@outlook.com>

HOMEPAGE
https://codeberg.org/sylphenix/sff