README (5650B)
1 sfm - Simple File Manager 2 ========================== 3 4 5 DESCRIPTION 6 ----------- 7 sfm is a lightweight, terminal-based file manager written entirely in 8 POSIX sh. It runs in your terminal with no external dependencies beyond 9 standard Unix tools (ls, awk, tput, stty, mv, cp, rm). Designed to be 10 fast, flicker-free, and keyboard-driven with a vim-inspired key layout. 11 12 13 REQUIREMENTS 14 ------------ 15 - A POSIX-compatible shell (sh, dash, bash, etc.) 16 - Standard Unix tools: ls, awk, tput, stty, cp, mv, rm, mkdir, touch 17 - Optional: wl-copy / xclip / xsel / pbcopy (for clipboard support) 18 - Optional: mpv, vlc, feh, zathura, etc. (for smart file opening) 19 - Optional: readlink (for symlink display) 20 - Optional: file (for MIME type detection) 21 22 23 INSTALLATION 24 ------------ 25 Using make (recommended): 26 27 make install 28 29 This installs sfm to /usr/local/bin by default. To change the prefix: 30 31 make install PREFIX=/usr 32 33 To uninstall: 34 35 make uninstall 36 37 Manual installation: 38 39 cp sfm /usr/local/bin/sfm 40 chmod +x /usr/local/bin/sfm 41 42 43 USAGE 44 ----- 45 sfm [path] 46 47 If no path is given, sfm opens in the current directory. 48 49 Examples: 50 sfm # open in current directory 51 sfm /mnt/data # open at a specific path 52 sfm ~ # open home directory 53 sfm .. # open parent directory 54 55 56 NAVIGATION 57 ---------- 58 j / k or up/down arrows Move up / down 59 h or left arrow Go to parent directory 60 l or right arrow / enter Open file or enter directory 61 g Jump to top of list 62 G Jump to bottom of list 63 ~ Go to home directory 64 ` (backtick) Jump to previous directory 65 66 67 SEARCH & FILTER 68 --------------- 69 / Enter search mode (filters listing as you type) 70 esc Clear filter and exit search mode 71 enter Exit search mode but keep filter active 72 73 74 DISPLAY TOGGLES 75 --------------- 76 . Toggle hidden files (dotfiles) 77 T Toggle size/date detail column 78 P Toggle preview pane (right side) 79 s Cycle sort mode: name -> size -> date 80 i Show file info (permissions, size, date) in status bar 81 R Refresh current directory listing 82 83 84 PREVIEW PANE 85 ------------ 86 Press P to toggle the preview pane on the right side of the screen. 87 The list pane takes the left half, preview takes the right half. 88 89 Text files Shows file contents line by line 90 Directories Shows directory contents 91 Symlinks Shows link target 92 Binary files Shows file size 93 94 95 CUSTOM OPENER 96 ------------- 97 sfm checks for a user-defined opener script at: 98 99 ~/.config/sfm/opener 100 101 If the file exists and is executable, sfm passes the selected file 102 path to it instead of using the built-in smart opener. Example: 103 104 #!/bin/sh 105 case "$1" in 106 *.jpg|*.jpeg) imv "$1" ;; 107 *.mp4) mpv "$1" ;; 108 *.html|*.pdf) firefox "$1" ;; 109 *) echo "no program set for this file type" ;; 110 esac 111 112 Make it executable: chmod +x ~/.config/sfm/opener 113 114 If the opener script does not exist, sfm falls back to its built-in 115 smart opener automatically. 116 117 118 FILE OPERATIONS 119 --------------- 120 r Rename selected entry 121 m Make new directory 122 n New empty file 123 d Delete (single or selection) 124 u Move to trash (safe delete) 125 U Open trash directory 126 o Open with custom program 127 128 129 CLIPBOARD 130 --------- 131 y Yank / copy (works on multi-selection) 132 x Cut (works on multi-selection) 133 p Paste into current directory 134 c Copy full path of selected entry to system clipboard 135 136 137 MULTI-SELECT 138 ------------ 139 space Toggle multi-select on current entry (cursor advances) 140 a Select all / deselect all 141 142 143 BOOKMARKS 144 --------- 145 b Bookmark current directory (press again to remove) 146 B Open bookmark picker (j/k navigate, enter jump) 147 148 Bookmarks are saved to: ~/.config/sfm/bookmarks 149 150 151 SHELL & UTILITIES 152 ----------------- 153 ! Drop into $SHELL in current directory (type "exit" to return) 154 155 156 HELP 157 ---- 158 ? Show keyboard shortcuts overlay 159 160 161 QUIT 162 ---- 163 q Quit sfm 164 165 166 STATUS BAR INDICATORS 167 --------------------- 168 [hidden] Hidden files are visible 169 [sort:size] Active sort mode (size or date; name is default) 170 [copy] A file is in the clipboard (copy mode) 171 [cut] A file is in the clipboard (cut mode) 172 [sel:N] N items are currently selected 173 [details] Size/date column is visible 174 175 176 SMART FILE OPENER 177 ----------------- 178 When you open a file, sfm detects the file type by extension and 179 MIME type, then picks an appropriate program automatically: 180 181 Text / code $EDITOR (or vi) 182 Images imv, feh, sxiv, eog, gimp 183 Video mpv, vlc, mplayer, totem 184 Audio mpv, vlc, cmus, mocp 185 PDF zathura, evince, okular, mupdf 186 Office docs libreoffice 187 Archives atool / bsdtar (lists contents in pager) 188 189 Falls back to xdg-open, open (macOS), or $EDITOR if nothing matches. 190 Use 'o' to manually specify any program. 191 192 193 TRASH 194 ----- 195 Files deleted with 'u' are moved to: 196 197 ~/.local/share/sfm-trash/ 198 199 Files are prefixed with a timestamp: YYYYMMDD_HHMMSS_filename 200 Use U to browse the trash directory. To restore a file, rename it 201 (press r) to remove the timestamp prefix, then cut (x) and paste (p) 202 it back to the desired location. 203 204 205 DATA FILES 206 ---------- 207 ~/.config/sfm/bookmarks Saved bookmarks (one path per line) 208 ~/.config/sfm/opener Custom file opener script (optional) 209 ~/.local/share/sfm-trash/ Trashed files 210