Table of Contents
- Tips and Tricks
- Move a quarter page
- Scroll an eighth of the file list
- Type-to-navigate
- Quickly locate a file via fzf
- Select files downward or upward
- Range selection
- Change the default editor
- Copy/Cut and paste files
- Batch create files and directories
- Batch rename
- Batch modify permissions or ownership
- Undo and Redo
- Sudo mode
- Advanced Search
- View disk usage of directories
- File preview
- Create archives
- macOS specific notes
Tips and Tricks
Move a quarter page
Press Ctrl+j/Down to move down or Ctrl+k/Up to move up a quarter of a page. This quick navigation can significantly improve efficiency when browsing.
Scroll an eighth of the file list
When the current directory contains a large number of files (e.g., tens of thousands), browsing through them page by page can be time-consuming. In such cases, you can press F to scroll forward or B to scroll backward by an eighth of the file list. This allows you to quickly skim through the files.
Type-to-navigate
This feature is implemented through Quick Find. Press f to activate Quick Find, then enter a matching string to quickly locate the desired directory. Press Tab or / to enter the directory and clear the input string, then start the next matching operation. When navigation is complete, press Enter or Esc to exit Quick Find.
While Quick Find is active, you can press Up or Down to move the cursor, or press Left to go to the parent directory. If the first character entered in Quick Find is /, sff will jump to the root directory. You can also paste a path from the system clipboard into Quick Find to navigate to it, provided the path exists.
Quickly locate a file via fzf
This feature requires fzf. Press Alt+F to run fzf in the current directory and enter a fuzzy-matching string to quickly find a file. Press Enter to locate the file in sff, or press Esc to cancel.
Select files downward or upward
Press J / Shift+Down to select the current file and move downward, or K / Shift+Up to select and move upward. This allows you to conveniently select files continuously in either direction.
Range selection
Move to the start file and press m. The details of the file will be highlighted in reverse as a marker. Then, move to the end file and press m again. All files between the start and end files will be selected. If you press M at the end file, all files between the start and end files will be deselected.
Change the default editor
By default, sff uses vi as its editor. You can change the default editor by setting the EDITOR environment variable. For example, to use nano in bash or sh, run:
export EDITOR=nano
To make this change persistent, add the above line to your shell's configuration file (e.g., .bashrc, .zshrc).
Copy/Cut and paste files
Press Alt+y to copy or Alt+x to cut selected files. Navigate to the target directory and press Alt+p to paste the files. You cannot paste into the directory you are copying from. If you want to duplicate files, use the duplicate function. Copy/cut and paste operations can apply across different tabs and different sff instances.
After copying, press Alt+P(uppercase) to paste while retaining the copy buffer. This allows you to paste the copied files again in other locations. You can press Alt+v to view the buffer or Alt+V(uppercase) to clear it.
Batch create files and directories
In the target directory, press Alt+n, enter filenames (append / for directories) in the editor, one per line, then save and exit. File names can also include paths, and any non-existent directories in the path will be automatically created. For example, entering:
foo1
foo2/
foo3/foo4
foo5/foo6/
will create the directories foo2, foo3, foo5, foo5/foo6, as well as the files foo1 and foo3/foo4.
Batch rename
Select the files you want to rename, then press Alt+r. The filenames will be listed in the editor, where you can edit them directly. After making your changes, save and exit the editor.
If the selected files are located in different directories, the editor will list their full paths. The parts of the paths before the filenames are only for reference, and modifying or deleting them will not affect the renaming result. Everything before the last / in each line will be discarded before the renaming process.
Batch modify permissions or ownership
Select the files you want to modify and press Alt+m. Enter the desired permissions or ownership:
- For permissions, input a mode string (e.g.,
a+w,644), which corresponds to the modes parameter of thechmodcommand. - For ownership, input owner:group (e.g.,
cat:wheel), which corresponds to the owner:group parameter of thechowncommand.
The program automatically determines whether to use chmod or chown based on whether the input contains a colon :. To apply the changes recursively to subdirectories, prefix the input with -R (e.g., -R 644, -R cat:wheel), which works for both chmod and chown.
Undo and Redo
sff supports undoing or redoing the last file operation. Supported operations include:
- Create new files
- Copy-paste (when none of the pasted files already exist)
- Cut-paste (when none of the pasted files already exist)
- Rename
- Duplicate
After performing any of the above operations, you can press Alt+u to undo the action. To redo an undone operation, press Alt+U(uppercase). Undo and redo actions apply across different tabs and even different sff instances. For example, a file operation performed in one sff instance can be undone or redone in another instance.
Sudo mode
When sff is run as a regular user, pressing Ctrl+t switches to sudo mode. In this mode, the following operations are be executed with superuser (root) privileges:
- All extension functions (including all file operations)
- All plugins
- File editing
All other operations are still performed by the current user, since the program is still running in the user's context. Press Ctrl+t again to exit sudo mode.
Advanced Search
Press Alt+f to access the advanced search function, which is implemented using the find command. It requires two inputs:
- Filename pattern: This is passed to the
-nameoption of thefindcommand. So remember to use wildcards when necessary. For example, to search for files containinglibin their name, enter*lib*instead of justlib. If you do not want to search by filename, enter*to match all files. - Additional search options: Here, you can provide more options for the
findcommand, such as-size +4kto search for files larger than 4KB. If no additional options are needed, leave this field blank and pressEnter.
After both inputs are provided, the executed command will be:
find ./ input2 -name "input1"
The search results are sent back to sff and listed in the fifth tab, where you can further process them.
View disk usage of directories
Select the directories (or files) you want to check, then press Alt+I(uppercase). sff will list the disk space usage of each selected directory (or file), sorted from smallest to largest, and also display the total space occupied.
File preview
You can press Alt+= to enable or disable file preview.
When sff is running inside tmux:
- Enabling preview will split a new pane for display.
When sff is running outside tmux:
-
If
SFF_PV_TERMis set, enabling preview will launch the terminal emulator specified by this environment variable as the previewer. -
If
SFF_PV_TERMis not set, enabling preview will prompt you to enter the name of a terminal emulator to use temporarily as the previewer.
Create archives
Select the files you want to archive, press Alt+Z(uppercase), then enter an archive filename with extension (e.g., foo.tar.gz, foo.txz, foo.zip). The new archive file will be created in the current directory. Supported archive formats include gz, bz2, xz, tar (with gz, bz2, xz compression), zip, and 7z.
Key behaviors:
-
For tar-based formats: Files will be archived using relative paths only if all selected files are located within the current directory or its subdirectories; otherwise, absolute paths will be used.
-
For zip or 7z formats: All selected files will be placed directly in the archive's root directory without preserving the original directory structure.
-
When entering just
.gz,.bz2, or.xzas the filename: Each selected file will be individually compressed in the chosen format.
macOS specific notes
sff on macOS depends on ncurses from Homebrew. Before compiling and installing sff, you must install it first:
brew install ncurses
Build and install
- For Apple Silicon Macs:
sudo make install INCS='-I/opt/homebrew/opt/ncurses/include' LIBS='-L/opt/homebrew/opt/ncurses/lib -lncursesw'
- For Intel Macs:
sudo make install INCS='-I/usr/local/opt/ncurses/include' LIBS='-L/usr/local/opt/ncurses/lib -lncursesw'
For Alt+key to work properly, you need to configure your terminal emulator:
-
Terminal.app: Go to Terminal > Preferences. In the
Profilessection, checkUse Option as Meta key. -
iTerm2: Go to iTerm2 > Preferences. In the
Profilessection, select theKeystab. SetLeft Option KeyandRight Option KeytoEsc+.
The preview plugin currently works only within tmux on macOS. To enable preview functionality, please run sff inside a tmux session.