rtfm-filemanager 7.3.6 → 7.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -1,678 +1,683 @@
1
1
  # RTFM - Ruby Terminal File Manager
2
2
 
3
- ![Ruby](https://img.shields.io/badge/language-Ruby-red) [![Gem Version](https://badge.fury.io/rb/rtfm-filemanager.svg)](https://badge.fury.io/rb/rtfm-filemanager) ![Unlicense](https://img.shields.io/badge/license-Unlicense-green) ![Stay Amazing](https://img.shields.io/badge/Stay-Amazing-important)
3
+ ![Ruby](https://img.shields.io/badge/language-Ruby-red) [![Gem Version](https://badge.fury.io/rb/rtfm-filemanager.svg)](https://badge.fury.io/rb/rtfm-filemanager) ![Unlicense](https://img.shields.io/badge/license-Unlicense-green) [![Documentation](https://img.shields.io/badge/docs-comprehensive-blue)](docs/) ![Stay Amazing](https://img.shields.io/badge/Stay-Amazing-important)
4
4
 
5
- ## Version 7.2
5
+ <img src="img/logo.png" align="left" width="150" height="150">
6
6
 
7
- **BREAKING CHANGE** - Batch Operation Behavior:
7
+ A feature-rich terminal file manager written in pure Ruby. Browse directories with syntax-highlighted previews, inline images, remote SSH/SFTP access, comprehensive undo system, OpenAI integration, and much more.
8
8
 
9
- Version 7.2 introduces a **breaking change** to how batch operations work with tagged items:
9
+ RTFM parses your LS_COLORS for consistent terminal theming and runs on any modern terminal emulator.
10
10
 
11
- - **Previous behavior**: Operations affected tagged items + selected item (always)
12
- - **New behavior**: Operations affect tagged items OR selected item (not both)
13
- - When items ARE tagged → operate ONLY on tagged items
14
- - When NO items are tagged → operate on selected item only
11
+ <br clear="left"/>
15
12
 
16
- This provides consistent, predictable behavior across all operations including: delete, copy, move, symlink, bulk rename, change permissions, change ownership, and open.
13
+ ## Quick Start
17
14
 
18
- **Migration**: If you want the selected item included in a batch operation, explicitly tag it first with 't'.
15
+ ```bash
16
+ # Install
17
+ gem install rtfm-filemanager
19
18
 
20
- ## Version 7.1
19
+ # Run
20
+ rtfm
21
21
 
22
- Version 7.1 adds comprehensive compressed archive viewing capabilities:
22
+ # Or start in specific directory
23
+ rtfm ~/Documents
23
24
 
24
- - **Archive preview** for .zip, .tar, .gz, .tgz, .bz2, .tbz, .tbz2, .xz, .txz, .rar, .7z files
25
- - **Smart fallback** for compressed archives vs standalone compressed files
26
- - **Seamless integration** with existing preview system
25
+ # Press ? for help
26
+ ```
27
27
 
28
- Version 6.0 introduced comprehensive remote directory browsing capabilities and enhanced user experience improvements including remote SSH/SFTP browsing, SSH shell integration, enhanced help system, and comprehensive undo system.
28
+ After first run, use `r` command to launch RTFM and exit into your current directory.
29
+
30
+ ---
31
+
32
+ ## Table of Contents
33
+
34
+ - [Key Features](#key-features)
35
+ - [Installation](#installation)
36
+ - [Keyboard Reference](#keyboard-reference)
37
+ - [Remote SSH/SFTP Browsing](#remote-sshsftp-browsing)
38
+ - [Configuration](#configuration)
39
+ - [Plugins](#plugins)
40
+ - [Image Display](#image-display)
41
+ - [RTFM vs Ranger](#rtfm-vs-ranger)
42
+ - [Documentation](#documentation)
43
+
44
+ ---
45
+
46
+ ## Key Features
47
+
48
+ ### File Operations
49
+ - **Comprehensive undo system** - Undo delete, move, rename, copy, symlink, permissions, ownership
50
+ - **Trash bin** - Optional safe deletion with restore capability
51
+ - **Bulk operations** - Copy, move, delete multiple tagged items
52
+ - **Bulk rename** - Pattern-based renaming (regex, templates, case conversion)
53
+ - **Permission management** - Change permissions with undo support (`755`, `rwxr-xr-x`, `+x`, `-w`)
54
+ - **Ownership management** - Change user:group with undo support
55
+
56
+ ### Display & Preview
57
+ - **Syntax highlighting** - File content with bat/batcat
58
+ - **Inline images** - w3m and Sixel protocols via termpix gem
59
+ - **EXIF orientation** - Correct display of rotated images
60
+ - **Video thumbnails** - ffmpegthumbnailer integration
61
+ - **Archive preview** - View contents of .zip, .tar, .gz, .rar, .7z files
62
+ - **Document preview** - PDF, LibreOffice, MS Office files
63
+ - **LS_COLORS parsing** - Consistent terminal color theming
64
+
65
+ ### Remote Operations
66
+ - **SSH/SFTP browsing** - Navigate remote directories seamlessly
67
+ - **Interactive SSH shell** - Drop into shell sessions on remote hosts
68
+ - **File transfer** - Download and upload files
69
+ - **Connection caching** - Smart caching for performance
70
+
71
+ ### Advanced Features
72
+ - **Git integration** - Status display for repositories
73
+ - **Cryptographic hashing** - Directory tree verification
74
+ - **OpenAI integration** - File descriptions and interactive chat
75
+ - **Tab management** - Multiple tabs with duplication and renaming
76
+ - **Fuzzy search** - fzf integration
77
+ - **Navi integration** - Interactive command cheatsheets
78
+
79
+ ### Developer Features
80
+ - **Plugin architecture** - Custom preview handlers and key bindings
81
+ - **Ruby debug mode** - Execute arbitrary Ruby in context
82
+ - **Command history** - Preserved across sessions
83
+ - **Extensible** - Clean plugin API
84
+
85
+ ---
29
86
 
30
- Version 5 was a complete rewrite using [rcurses](https://github.com/isene/rcurses) as the underlying library, providing stability, higher quality code and extensive features including optional trash bin, advanced OpenAI integrations, plugin architectures for keybindings, user defined features and file viewers.
87
+ ## Installation
31
88
 
32
- The major feature additions are marked in ***bold italic***.
89
+ ### via RubyGems (Recommended)
33
90
 
34
- ## What?
35
- <img src="img/logo.png" align="left" width="150" height="150"> RTFM is a
36
- terminal file manager jam packed with features.
91
+ ```bash
92
+ gem install rtfm-filemanager
93
+ ```
37
94
 
38
- Apart from viewing and manipulating directories, you get syntax highlighting
39
- of file content, image and video thumbnailing in the terminal, OpenAI
40
- integration, system info panel, git status, fzf and navi integration and much,
41
- much more.
95
+ ### Full Installation with All Features
42
96
 
43
- Note: RTFM (Ruby Terminal File Manager) works best with the (u)rxvt, xterm and
44
- Eterm terminal emulators.
97
+ #### Ubuntu/Debian:
98
+ ```bash
99
+ sudo apt update
100
+ sudo apt install ruby-full x11-utils xdotool bat pandoc poppler-utils \
101
+ odt2txt docx2txt unzip gnumeric catdoc w3m imagemagick \
102
+ ffmpegthumbnailer tar gzip bzip2 xz-utils unrar p7zip-full
45
103
 
46
- ### Features
47
- RTFM is one of the most feature rich terminal file managers. Some of the
48
- features are:
49
-
50
- * RTFM parses your LS_COLORS to ensure color consistency with the terminal experience
51
- * Images are shown inline in the terminal (can be turned off)
52
- * File contents is shown with proper syntax highlighting
53
- * Item's meta data is shown at the top
54
- * Easily browse file content (pdf, MS/OpenOffice, etc.)
55
- * Move around the file systems using arrow keys or VI keys
56
- * Copy, move, rename, symlink and delete files easily
57
- * Simply use 'r' in your terminal to launch RTFM - and exit into the directory where you ended RTFM
58
- * ***Toggle the use of a "trash bin" to move dirs/files there instead of deleting***
59
- * Easily copy an item's path to clipboard or primary selection
60
- * Order items the way you want, see only files of a certain type
61
- * Filter out all files not matching a [regex](https://www.rubyguides.com/2015/06/ruby-regex/) pattern
62
- * Mark files and directories and do group actions on them
63
- * Bookmark directories for easy jumping
64
- * Follow a symlink to where it points with one key stroke
65
- * Highlight files and directories matching a given pattern
66
- * Find items using `locate` and jump directly to the desired item
67
- * Find items and jump there using fuzzy search (with [fzf](https://github.com/junegunn/fzf))
68
- * Execute any shell command from inside RTFM - ***incuding other curses applications***
69
- * [navi](https://github.com/denisidoro/navi) integration for easier command executions
70
- * Easily unpack or create archives
71
- * Show git status for the current directory
72
- * Show comprehensive system info (processes running, disk space, dmesg, etc.)
73
- * See if a directory (with sub dirs) has changed using cryptographic hashes
74
- * ***Remote directory browsing via SSH/SFTP*** with seamless navigation and file operations
75
- * ***SSH shell integration*** for dropping into interactive shell sessions on remote hosts
76
- * ***Remote file operations*** including download, upload, and file info display
77
- * Integration with OpenAI to get an executive summary of file content
78
- * ***OpenAI chat integrated; Discuss files, content, commands with OpenAI***
79
- * ***Enhanced tab management*** with duplication, renaming, and smart navigation
80
- * ***Improved stability*** with simplified architecture and eliminated flickering
81
- * ***Automatic image redraw*** after workspace switching (i3-wm compatible)
82
- * Possibility to change top line background when matching a path
83
- * Theming of pane colors
84
-
85
- ## Why?
86
- The idea came to mind as I was working on [a complete LS_COLORS
87
- setup](https://github.com/isene/LS_COLORS) with a corresponding
88
- [ranger](https://ranger.github.io/) theme. But making a separate theme for
89
- ranger to mimic a massive LS_COLOR setup is rather stupid. File managers
90
- should parse LS_COLORS as default rather than implement their own themes. This
91
- became an itch that I kept scratching until I could happily replace ranger two
92
- weeks later. But, coding RTFM based on the old curses library was clumsy,
93
- inefficient and painful. So I decided to create
94
- [rcurses](https://github.com/isene/rcurses) - a complete curses library
95
- written from scratch in pure Ruby - and from v5 and onwards, RTFM is based
96
- completely on this modern curses implementation.
97
-
98
- ## How?
99
- RTFM is a modern two-pane file manager with **enhanced tab support** for multi-directory navigation. You navigate in the left pane and the content of the selected item (directory or file) is shown in the right pane. The right pane is also used to show information such as the currently tagged items, your (book)marks, output from commands, error messages, etc.
100
-
101
- The **tab system** is visible in the top-right corner showing your current position like `[2/5]` (tab 2 of 5 total tabs). The tab bar displays when you have multiple tabs or use tab commands, showing directory names and management shortcuts.
102
-
103
- **Enhanced Tab Features:**
104
- * **Multiple tabs** for easy multi-directory management
105
- * **Tab duplication** (`}`) to quickly copy current directory context
106
- * **Tab renaming** (`{`) for better organization
107
- * **Smart tab display** showing current directory and shortcuts
108
- * **Quick tab switching** with number keys (1-9), J/K navigation
109
- * **Visual tab indicator** in top-right corner `[current/total]`
110
-
111
- When you start RTFM, you can supply a directory path as an argument to let
112
- RTFM start up in that directory. When you exit it exits into the current RTFM
113
- directory.
114
-
115
- You can run any command in the bottom "command bar" and have the output
116
- presented in the right pane. History of commands are preserved like in your
117
- shell.
118
-
119
- ## Remote Directory Browsing
120
-
121
- RTFM includes comprehensive **remote directory browsing** capabilities via SSH/SFTP, allowing you to seamlessly navigate and manage files on remote servers directly from your local terminal.
122
-
123
- **Key Remote Features:**
124
- * **Seamless remote navigation** - Browse remote directories as if they were local
125
- * **SSH shell integration** - Drop into interactive shell sessions with `s` key
126
- * **File operations** - Download (`d`), upload (`u`), and view file info (`→`)
127
- * **Connection caching** - Intelligent caching for improved performance
128
- * **Multiple connection formats** supported
129
-
130
- **Connection Examples:**
104
+ gem install rtfm-filemanager
105
+ ```
106
+
107
+ #### macOS:
131
108
  ```bash
132
- # Basic SSH connection
133
- user@server.com:/path/to/directory
109
+ brew install ruby imagemagick w3m bat pandoc poppler
134
110
 
135
- # With custom SSH key
136
- -i ~/.ssh/custom-key user@server.com:/path
111
+ gem install rtfm-filemanager
112
+ ```
137
113
 
138
- # SSH URI format
139
- ssh://user@server.com/path/to/directory
114
+ ### Dependencies
140
115
 
141
- # Key at end format
142
- user@server.com:/path -i ~/.ssh/custom-key
116
+ **Required:**
117
+ - Ruby 2.7+
118
+ - rcurses gem (~> 6.0)
119
+ - termpix gem (~> 0.2)
143
120
 
144
- # With comments for organization
145
- user@server.com:/path # Production server
146
- admin@192.168.1.10 # Local development
147
- ```
121
+ **Optional (for full functionality):**
122
+ - **ImageMagick** - Image preview (`identify`, `convert`)
123
+ - **w3m-img** - w3m image protocol
124
+ - **xdotool** - Image redraw on workspace switching
125
+ - **bat/batcat** - Syntax highlighting
126
+ - **fzf** - Fuzzy file finding
127
+ - **pandoc** - Document conversion
128
+ - **ffmpegthumbnailer** - Video thumbnails
129
+ - **ruby-openai** - AI integration
148
130
 
149
- **Remote Mode Usage:**
150
- 1. Press `Ctrl+E` to enter/exit remote mode
151
- 2. Enter connection string when prompted
152
- 3. Navigate with standard keys (`←`, `→`, `↑`, `↓`)
153
- 4. Use `d` to download files, `u` to upload files
154
- 5. Press `s` to open SSH shell in current remote directory
155
- 6. Press `Ctrl+E` to return to local mode
131
+ ---
156
132
 
157
- The remote browsing feature includes visual indicators (red background) to clearly show when you're in remote mode, and all standard RTFM navigation and information features work seamlessly with remote directories.
133
+ ## Keyboard Reference
158
134
 
159
- ## Installation
160
- You can install RTFM by cloning this repo and put the file `rtfm` in your
161
- "bin" directory. If you do, you need to install
162
- [rcurses](https://github.com/isene/rcurses) first.
163
-
164
- Or you can simply run `gem install rtfm-filemanager`.
165
-
166
- There are two basic prerequisites needed: `x11-utils` and `xdotool`. On
167
- Ubuntu these would be installed via `apt install x11-utils xdotool`.
168
-
169
- Content of text files are handled by `cat` - or by `bat` if you want beautiful
170
- highlighting. Other files are shown via external programs (Debian/Ubuntu
171
- family of Linux distros command in last column):
172
-
173
- File type | Requirements | Installation
174
- ----------------------------|----------------------------------|-------------------------------
175
- Syntax highlighting of text | `bat` | `apt install bat`
176
- Markdown | `pandoc` | `apt install pandoc`
177
- PDFs | `pdftotext` | `apt install poppler-utils`
178
- LibreOffice | `odt2txt` | `apt install odt2txt`
179
- MS docx | `docx2txt` | `apt install docx2txt`
180
- MS pptx | `unzip` | `apt install unzip`
181
- MS xlsx | `ssconvert` | `apt install gnumeric`
182
- MS doc/xls/ppt | `catdoc`, `xls2csv` and `catppt` | `apt install catdoc`
183
- Images | `w3m` and `ImageMagick` | `apt install w3m imagemagick`
184
- Video (thumbnails) | `ffmpegthumbnailer` | `apt install ffmpegthumbnailer`
185
- Compressed archives | `unzip`, `tar`, `gzip`, `bzip2`, `xz` | `apt install unzip tar gzip bzip2 xz-utils`
186
- RAR archives | `unrar` | `apt install unrar`
187
- 7-Zip archives | `7z` | `apt install p7zip-full`
188
-
189
- Install rtfm from scratch with all of the above on Ubuntu:
190
- ```
191
- sudo apt update
192
- sudo apt install ruby-full git libncurses-dev x11-utils xdotool bat pandoc poppler-utils odt2txt docx2txt unzip gnumeric catdoc w3m imagemagick ffmpegthumbnailer tar gzip bzip2 xz-utils unrar p7zip-full
193
- sudo gem install rcurses
194
- git clone https://github.com/isene/RTFM
195
- cd RTFM
196
- sudo cp rtfm /usr/bin/
197
- ```
198
- Or with a simpler gem install:
199
- ```
200
- sudo apt update
201
- sudo apt install ruby-full git libncurses-dev x11-utils xdotool bat pandoc poppler-utils odt2txt docx2txt unzip gnumeric catdoc w3m imagemagick ffmpegthumbnailer tar gzip bzip2 xz-utils unrar p7zip-full
202
- gem install rtfm-filemanager
203
- ```
135
+ For complete reference: `man rtfm` or press `?` in RTFM
136
+
137
+ ### Essential Keys
138
+
139
+ | Key | Action |
140
+ |-----|--------|
141
+ | `?` | Show help |
142
+ | `q` | Quit (save config) |
143
+ | `Q` | Quit (don't save) |
144
+ | `r` | Refresh display |
204
145
 
205
- ## Screenshot
206
- ![RTFM screenshot](img/screenshot-logo.png)
207
-
208
-
209
- ## Image preview in the terminal
210
- RTFM uses w3mimgdisplay (part of the w3m package) to show images in the
211
- terminal. Some terminals have an issue with this - either the images don't
212
- show, the previous image is not cleared (new image overlaps the previous) or
213
- they show for only a flash or a few seconds. The table below shows how the
214
- most popular terminals fare with this. An "O" indicates that the terminal is
215
- OK, while an "X" indicates that it fails:
216
-
217
- Terminal |Images | No overlap | Images stay
218
- --------------|-------|------------|-----------
219
- (u)rxvt | O | O | O
220
- xterm | O | O | O
221
- Eterm | O | O | O
222
- kitty | O | O | O
223
- alacritty | O | O | X
224
- terminology | O | O | X
225
- stterm | O | O | X
226
- gnome-terminal| O | X |
227
- xfce4-terminal| O | X |
228
- mate-terminal | O | X |
229
- lilyterm | O | X |
230
- termit | X | |
231
- lxterminal | X | |
232
- qterminal | X | |
233
-
234
-
235
- ## Keys
236
- These are the set of keys to move around and do actions within RTFM:
237
-
238
- ### Basic keys
239
- Key | Description
240
- ---------|------------------------------------------------------------------
241
- ? | Show this help text
242
- v | Display RTFM version (and latest Gem version) in bottom window/command bar
243
- r | Refresh RTFM (recreates all windows. Use on terminal resize or when there is garbage somewhere)
244
- R | Reload configuration (~/.rtfm/conf)
245
- W | Write parameters to ~/.rtfm/conf: @marks, @hash, @history, @rubyhistory, @aihistory, @lslong, @lsall, @lsorder, @lsinvert, @width, @border, @preview, @trash
246
- C | ***Show the current configuration in ~/.rtfm/conf***
247
- q | Quit (save basic configuration: @marks, @hash, @history, @rubyhistory, @aihistory)
248
- Q | QUIT (without writing any changes to the config file)
249
-
250
- ### Layout
251
- Key | Description
252
- ---------|------------------------------------------------------------------
253
- w | Change the width of the left/right panes (left pane ⇒ 20%, 30%, 40%, 50%, 60%)
254
- B | Cycle border
255
- \- | (Minus sign) Toggle preview in right pane (turn it off for faster traversing of directories)
256
- _ | (Underscore) Toggle preview of images in right pane
257
- b | Toggle syntax highlighting (and line numbering)
258
-
259
- ### Motion
260
- Key | Description
261
- ---------|------------------------------------------------------------------
262
- j/DOWN | Go one item down in left pane (rounds to top)
263
- k/UP | Go one item up in left pane (rounds to bottom)
264
- h/LEFT | Go up one directory level
265
- l/RIGHT | Enter directory or open file (using run-mailcap or xdg-open) Use the key 'x' to force open using xdg-open (or run-mailcap) - used for opening html files in a browser rather than editing the file in your text editor
266
- PgDown | Go one page down in left pane
267
- PgUp | Go one page up in left pane
268
- END | Go to last item in left pane
269
- HOME | Go to first item in left pane
270
-
271
- ### Marks and jumping
272
- Key | Description
273
- ---------|------------------------------------------------------------------
274
- m | Mark current dir (persistent). Next letter is the name of the mark [a-zA-Z'] The special mark "'" jumps to the last directory (makes toggling dirs easy) Press '-' and a letter to delete that mark. Mark '0' is the dir where RTFM was started. Marks '1' - '5' are the past five directories visited
275
- M | Show marked items in right pane
276
- ' | Jump to mark (next letter is the name of the mark [a-zA-Z']) The 5 latest directories visited are stored in marks 1-5 (1 being the very latest)
277
- ~ | Jump to Home directory
278
- \> | Follow symlink to the directory where the target resides
279
-
280
- ### Directory views
281
- Key | Description
282
- ---------|------------------------------------------------------------------
283
- a | Show all (also hidden) items
284
- A | Show long info per item (show item attributes)
285
- o | Change the order/sorting of directories (circular toggle)
286
- i | Invert/reverse the sorting
287
- O | Show the Ordering in the bottom window (the full ls command)
146
+ ### Navigation
147
+
148
+ | Key | Action |
149
+ |-----|--------|
150
+ | `j` / `↓` | Move down |
151
+ | `k` / `↑` | Move up |
152
+ | `h` / `←` | Parent directory |
153
+ | `l` / `→` / `ENTER` | Enter directory / open file |
154
+ | `HOME` / `END` | First / last item |
155
+ | `PgUp` / `PgDn` | Page up / down |
156
+
157
+ ### Marks & Jumping
158
+
159
+ | Key | Action |
160
+ |-----|--------|
161
+ | `m` + letter | Set bookmark |
162
+ | `'` + letter | Jump to bookmark |
163
+ | `~` | Jump to home |
164
+ | `>` | Follow symlink |
165
+ | `Ctrl-r` | Recent files/directories |
166
+ | `Ctrl-e` | Toggle remote SSH mode |
288
167
 
289
168
  ### Tagging
290
- Key | Description
291
- ---------|------------------------------------------------------------------
292
- t | Tag item (toggles)
293
- Ctrl-t | Add items matching a pattern to list of tagged items (Ctrl-t and then . will tag all items)
294
- T | Show currently tagged items in right pane
295
- u | Untag all tagged items
296
-
297
- ### Tab management
298
- Key | Description
299
- ---------|------------------------------------------------------------------
300
- ] | Create new tab in current directory
301
- [ | Close current tab (keeps at least one tab open)
302
- J | Previous tab (wraps around)
303
- K | Next tab (wraps around)
304
- } | Duplicate current tab (creates a copy with same directory)
305
- { | Rename current tab
306
- 1-9 | Switch to tab by number (1 = first tab, 2 = second tab, etc.)
307
-
308
- ### Manipulate items
309
- Key | Description
310
- ---------|------------------------------------------------------------------
311
- p | Put (copy) tagged items here
312
- P | PUT (move) tagged items here
313
- c | Change/rename selected (adds command to bottom window)
314
- s | Create symlink to tagged items here
315
- d | Delete selected item and tagged items. Confirm with 'y'. ***Moves items to trash directory (~/.rtfm/trash/) if @trash | true***
316
- D | ***Empty trash directory***
317
- Ctrl-d | ***Toggle use of trash directory***
318
- Ctrl-o | Change ownership to user:group of selected and tagged items
319
- Ctrl-p | Change permissions of selected and tagged items
320
- Format | rwxr-xr-x or 755 or rwx (applies the trio to user, group and others)
321
-
322
- ### Filter and search
323
- Key | Description
324
- ---------|------------------------------------------------------------------
325
- f | Show only files in the left pane matching extension(s) (e.g. "txt" or "pdf,png,jpg")
326
- F | Show only files matching a pattern (Ruby Regex) (e.g. "abc" or "ab.+12(\w3)+")
327
- Ctrl-f | Clear all filtering
328
- / | Enter search string in bottom window to highlight matching items and jump to the first match
329
- \\ | Remove search pattern
330
- n | Jump to the next item matched by '/'
331
- N | Jump to the previous item matched by '/'
332
- g | Run 'grep' to show files that contains the MATCH in current directory
333
- L | Start 'locate' search for files, then use '#' to jump to desired line/directory
334
- Ctrl-l | Locate files via fzf from the current directory down (fuzzy file finder must be installed https://github.com/junegunn/fzf)
335
-
336
- ### Archives
337
- Key | Description
338
- ---------|------------------------------------------------------------------
339
- z | Extract tagged zipped archive to current directory
340
- Z | Create zipped archive from tagged files/directories
341
-
342
- ### Git/hash/openai
343
- Key | Description
344
- ---------|------------------------------------------------------------------
345
- G | Show git status for current directory
346
- H | Do a cryptographic hash of the current directory with subdirs. If a previous hash was made, compare and report if there has been any change
347
- I | Show OpenAI's description of the selected item and its content (if available). You must have installed the ruby-openai gem and added your openai secret key in the ~/.rtfm/conf (add `@ai | "your-secret-openai-key") for this to work.
348
- Ctrl-a | ***Start an OpenAI chat (the context window is kept until you exit RTFM). The OpenAI agent is specialized in answering questions about cli, files and dirs***
349
-
350
- ### Right pane controls
351
- Key | Description
352
- ---------|------------------------------------------------------------------
353
- ENTER | Refresh the right pane
354
- S-RIGHT | ***One line down in the preview***
355
- S-LEFT | ***One line up in the preview***
356
- S-DOWN | ***Next page of the preview (if doc long and ∇ in the bottom right)*** (TAB does the same)
357
- S-UP | ***Previous page (if you have moved down the document first - ∆ in the top right)*** (or S-TAB)
358
-
359
- ### Clipboard copy
360
- Key | Description
361
- ---------|------------------------------------------------------------------
362
- y | Copy path of selected item to primary selection (for pasting with middle mouse button)
363
- Y | Copy path of selected item to clipboard
364
- Ctrl-y | Copy content of right pane to clipboard (turn off batcat syntax highlighting with 'b' for a clean copy of content)
365
-
366
- ### System shortcuts
367
- Key | Description
368
- ---------|------------------------------------------------------------------
369
- S | Show comprehensive System info (system, CPU, filesystem, latest dmesg messages)
370
- = | Create a new directory (a shortcut for ":mkdir ")
371
- Ctrl-n | Invoke navi (see https://github.com/denisidoro/navi) with any output in right window
372
-
373
- ### Command mode
374
- Key | Description
375
- ---------|------------------------------------------------------------------
376
- : | Enter "command mode" in bottom window (press ENTER to execute, press ESC to escape). Prefix the command with a '§' to force the program to run in interactive mode (full screen TUI programs like htop, vim or any shell)
377
- ; | Show command history in right pane
378
- \+ | ***Add program(s) to the list of full-UI interactive terminal programs***
379
-
380
-
381
- ### Ruby debug mode
382
- Key | Description
383
- ---------|------------------------------------------------------------------
384
- @ | Enter Ruby mode to execute any Ruby command (ENTER to execute, ESC to escape)
385
-
386
-
387
- ## Keyboard cheat sheet
388
- ![RTFM keyboard cheat sheet](img/rtfm-kb.png)
389
-
390
- ## First run
391
- The first time you run RTFM, you are greeted with a welcome message. RTFM will
392
- add a simple function to your shell (bash, zsh, fish, maybe others) that will
393
- let you launch RTFM via the one key command `r`. It also lets RTFM exit in the
394
- directory you are currently in (inside of RTFM) rather than where you launched
395
- RTFM.
396
-
397
- With this, you can jump around in your directory structure via RTFM, exit to
398
- the desired directory, do work in the terminal and go back into RTFM via `r`.
399
-
400
- If you want to launch rtfm straight into a specified directory, do this
401
- instead: `rtfm ~/mydir/subdir`
402
-
403
- ## Configuration file
404
- When you first exit RTFM, it will write your (book)marks and the set of tagged
405
- files to `.rtfm/conf`. This ensures your marks and tagged files are
406
- persistent. It also means you can launch rtfm tag a bunch of dirs and files,
407
- drop out back to the terminal to do some work, back into rtfm and resume to
408
- work with your previously tagged items.
409
-
410
- You can also set persistent variables in the config file manually:
411
-
412
- To have long info per item: `@lslong = true` (this is otherwise set to `false`)
413
-
414
- To show hidden files: `@lsall = "-a"` (this is otherwise set to `""`)
415
-
416
- To set a specific order for ls: `@lsorder = "-S"` (to order by size).
417
-
418
- To revert your ls order: `@lsinvert = "-r"`
419
-
420
- To set any additional 'ls' switches, set the variable `@lsuser`. To not list
421
- any files containg the word "test", you could do this:
422
- ```
423
- @lsuser = "--ignore=test"
424
- ```
425
- To suppress image viewing in the terminal: `@showimage = false`
426
169
 
427
- To suppress showing any content in the right pane: `@preview = false`
170
+ | Key | Action |
171
+ |-----|--------|
172
+ | `t` | Tag/untag item |
173
+ | `Ctrl-t` | Tag by pattern |
174
+ | `T` | Show tagged items |
175
+ | `u` | Untag all |
176
+
177
+ ### File Operations
178
+
179
+ | Key | Action |
180
+ |-----|--------|
181
+ | `p` | Copy tagged items here |
182
+ | `P` | Move tagged items here |
183
+ | `s` | Create symlinks |
184
+ | `c` | Rename item |
185
+ | `E` | Bulk rename (patterns) |
186
+ | `d` | Delete (→ trash if enabled) |
187
+ | `D` | Empty trash |
188
+ | `Ctrl-d` | Toggle trash on/off |
189
+ | `U` | Undo last operation |
190
+
191
+ ### Permissions
192
+
193
+ | Key | Action |
194
+ |-----|--------|
195
+ | `Ctrl-p` | Change permissions (with undo) |
196
+ | `Ctrl-o` | Change ownership (with undo) |
197
+
198
+ **Permission formats:** `755`, `rwxr-xr-x`, `rwx`, `+x`, `-w`, `+rw`
199
+
200
+ ### Search & Filter
201
+
202
+ | Key | Action |
203
+ |-----|--------|
204
+ | `f` | Filter by extension |
205
+ | `F` | Filter by regex |
206
+ | `/` | Search and highlight |
207
+ | `n` / `N` | Next / previous match |
208
+ | `g` | Grep content |
209
+ | `L` | Locate files |
210
+ | `Ctrl-l` | Fuzzy find (fzf) |
211
+
212
+ ### Display
213
+
214
+ | Key | Action |
215
+ |-----|--------|
216
+ | `-` | Toggle preview on/off |
217
+ | `_` | Toggle image preview |
218
+ | `b` | Toggle syntax highlighting |
219
+ | `w` | Change pane width |
220
+ | `B` | Cycle borders |
221
+ | `a` | Show/hide hidden files |
222
+ | `A` | Toggle long info (ls -l) |
223
+ | `o` | Change sort order |
224
+ | `i` | Invert sort |
225
+
226
+ ### Clipboard
227
+
228
+ | Key | Action |
229
+ |-----|--------|
230
+ | `y` | Copy path (primary selection) |
231
+ | `Y` | Copy path (clipboard) |
232
+ | `Ctrl-y` | Copy image/text to clipboard |
233
+
234
+ ### Git / AI / System
235
+
236
+ | Key | Action |
237
+ |-----|--------|
238
+ | `G` | Git status |
239
+ | `H` | Directory hash |
240
+ | `I` | OpenAI file description |
241
+ | `Ctrl-a` | OpenAI chat |
242
+ | `S` | System information |
243
+ | `X` | Compare two files |
244
+ | `e` | File properties |
245
+
246
+ ### Tabs
247
+
248
+ | Key | Action |
249
+ |-----|--------|
250
+ | `]` | New tab |
251
+ | `[` | Close tab |
252
+ | `J` / `K` | Previous / next tab |
253
+ | `}` | Duplicate tab |
254
+ | `{` | Rename tab |
255
+ | `1-9` | Switch to tab # |
256
+
257
+ ### Command Mode
258
+
259
+ | Key | Action |
260
+ |-----|--------|
261
+ | `:` | Execute shell command |
262
+ | `;` | Command history |
263
+ | `@` | Ruby debug mode |
264
+ | `§` | Force interactive mode (prefix) |
265
+ | `+` | Whitelist program as interactive |
266
+
267
+ **Interactive mode example:** `:§htop` - runs htop in full terminal
268
+
269
+ ---
270
+
271
+ ## Remote SSH/SFTP Browsing
272
+
273
+ Access and manage files on remote servers directly from RTFM.
274
+
275
+ ### Activating Remote Mode
276
+
277
+ 1. Press `Ctrl-e`
278
+ 2. Enter connection string:
279
+ ```
280
+ user@server.com:/path/to/directory
281
+ ```
282
+
283
+ ### Connection Formats
428
284
 
429
- To change the default width of the left pane: `@width = 5` (experiment with numbers 2-8).
285
+ ```bash
286
+ # Basic SSH
287
+ user@server.com:/path
430
288
 
431
- To toggle borders in RTFM: `@border = 1` (any number 0-3)
289
+ # Custom SSH key
290
+ -i ~/.ssh/custom-key user@server.com:/path
432
291
 
433
- To have some commands already prepared for the command history, you can set:
434
- ```
435
- @history = ["cat /home/me/MyTodo.txt", "neofetch --stdout"]
436
- ```
437
- To open files with `run-mailcap` instead of `open-xdg` set:
438
- ```
439
- @runmailcap = true
440
- ```
441
- ***To use the trash bin: `@trash = true`***
442
-
443
- ***To change the list of "whitelisted full-UI programs", change the variable @interactive.
444
- This is a comma separated string listing all programs that can be run from
445
- within RTFM's "command mode" (via the key `:`). Programs such as `htop`, `vim`
446
- and all shells will take over the terminal when they run and need explicit
447
- permission via this variable to be able to "replace" RTFM in the terminal.
448
- When you exit such a whitelisted program, RTFM resumes control. If you try to
449
- run such a program while it is not whitelisted, it will hang the terminal. To
450
- add a program to the whitelist inside RTFM, press the `+` key. All ususal
451
- shell comands that do not take over the full terminal such as `ls`, `touch`,
452
- `neofetch`, etc. will run just fine in command mode without being whitelisted.
453
- You can also explicitly run a program as interactive by prefixing the command
454
- with a single `§` - e.g. `:` `§saidar`. Programs added to @interactive will
455
- open as interactive also when opened via xdg-open or runmailcap (when you
456
- press `RIGHT` on a selected item).***
457
-
458
- All the variables above that you manually add to the top of the config files are
459
- undisturbed by launching and exiting RTFM.
460
-
461
- You can structure the config file the way you want. Let your OCD make it pretty.
462
-
463
- You can use `W` inside of RTFM to write all the parameters mentioned above to
464
- the config file - instead of adding them manually. Example: You press `+` to
465
- add `emacs` to your list of whitelisted interactive programs. Then you would
466
- want to press `W` to update @interactive in your config file so that `emacs`
467
- is permanently whitelisted as an interactive program for you.
468
-
469
- To exit RTFM without writing any changes to you marks or list of tagged items,
470
- exit with `Q`. They will then remain the same as when you launched RTFM for
471
- that session.
472
-
473
- ## Extra info
474
- The top line shows information about the currently item in the left pane. When
475
- you are at a file, the information is pretty self explanatory:
476
-
477
- `Path: /home/geir/RTFM/README.md (-rw-r--r-- geir:geir 2023-04-25 11:49 16K)`
478
-
479
- This shows the full path of the selected file as well as the permissions,
480
- ownership, timestamp and the size of the file. When you are at a directory in
481
- the left pane, you get two numbers in brackets. The first number is the number
482
- of regular dirs/files in that directory. The second shows the total number of
483
- entries, including the hidden directories and files:
484
-
485
- `Path: /home/geir/RTFM (drwxr-xr-x geir:geir 2023-04-29 01:55 4,0) [4 8]`
486
-
487
- Different file types may have extra self explanatory information included in
488
- square brackets at the end of the top info line. Image files will have the
489
- size of the image included while pdf files will have the number of pages. More
490
- file specific information will be included when I feel like adding such.
491
-
492
- ## Top and bottom line background colors
493
- You can customize the background colors for the top and bottom lines/panes.
494
-
495
- Bottom color is by default `238`. Change it by setting @bottomcolor to your
496
- desired colors in your `.rtfm/conf`.
497
-
498
- You can also set the background color at the bottom when you enter command
499
- mode (via `:`) by setting @cmdcolor and the Ruby mode (via `@`) by setting
500
- @rubycolor.
501
-
502
- Background color for OpenAI chats (invoked with `Ctrl-a`) is set with @aicolor.
503
-
504
- You can set the variable `@topmatch` in your `.rtfm/conf` so that it will change
505
- the background color of the top line/pane when you are in a directory matching
506
- a pattern.
507
-
508
- Example:
509
- ```
510
- @topmatch = [["passionfruit", 165], ["kiwi", 50], ["", 238]]
511
- ```
512
- With this, the background color of the top line/pane will be set to `165` if
513
- you are in a directory path that includes "passionfruits". The last pair is
514
- the default background color when no match is found. If you don't set this
515
- variable in your `.rtfm/conf`, rtfm will set this value to:
516
- ```
517
- @topmatch = [["", 238]]
292
+ # SSH URI
293
+ ssh://user@server.com/path
294
+
295
+ # With comment
296
+ user@server.com:/path # Production server
518
297
  ```
519
- Make sure to have a default value set as the last pair in `@topmatch`.
520
298
 
521
- ## Plugin architecture
522
- ***Upon first running RTFM, a few files are created in the `.rtfm/` directory.***
299
+ ### Remote Mode Keys
523
300
 
524
- One is `preview.rb`, the other is `keys.rb`.
301
+ | Key | Action |
302
+ |-----|--------|
303
+ | `←` / `h` | Parent directory |
304
+ | `→` / `ENTER` | Enter dir / show file info |
305
+ | `d` | Download file |
306
+ | `u` | Upload tagged files |
307
+ | `s` | Open SSH shell |
308
+ | `Ctrl-e` | Exit remote mode |
525
309
 
526
- You can add new "previewers" to show files with extensions that is not
527
- previewed by default in RTFM. The `preview.rb` explains how you add thesea:
528
- ```
529
- # ~/.rtfm/preview.rb
530
- #
531
- # Define one handler per line in the form:
532
- #
533
- # ext1, ext2, ext3 = command with @s placeholder
534
- #
535
- # @s will be replaced by the shell-escaped filename.
536
- #
537
- # Lines beginning with # or blank are ignored.
538
- #
539
- # Examples:
540
- # # plain text, Ruby, Python, shell
541
- # txt, rb, py, sh = bat -n --color=always @s
542
- #
543
- # # Alternative syntax highlighters (e.g., on macOS without bat)
544
- # # txt, rb, py, sh = highlight -O ansi --force --line-numbers @s
545
- #
546
- # # markdown via pandoc
547
- # md = pandoc @s -t plain
548
- #
549
- # # Alternative markdown viewers (e.g., lowdown, termmark)
550
- # # md = lowdown -Tterm @s
551
- # # md = termmark @s
552
- #
553
- # # PDFs
554
- # pdf = pdftotext -f 1 -l 4 @s -
310
+ **Visual indicator:** Red background when in remote mode
311
+
312
+ ---
313
+
314
+ ## Configuration
315
+
316
+ Configuration stored in `~/.rtfm/conf`
317
+
318
+ ### Quick Config
319
+
320
+ | Action | Command |
321
+ |--------|---------|
322
+ | View config | Press `C` |
323
+ | Save config | Press `W` |
324
+ | Reload config | Press `R` |
325
+
326
+ ### Common Settings
327
+
328
+ ```ruby
329
+ # ~/.rtfm/conf
330
+
331
+ # Enable trash bin
332
+ @trash = true
333
+
334
+ # Toggle preview on/off
335
+ @preview = true
336
+
337
+ # Show/hide images
338
+ @showimage = true
339
+
340
+ # Show hidden files
341
+ @lsall = "-a"
342
+
343
+ # Show long file info
344
+ @lslong = true
345
+
346
+ # Pane width (2-7)
347
+ @width = 5
348
+
349
+ # Border style (0-3)
350
+ @border = 2
351
+
352
+ # OpenAI API key
353
+ @ai = "your-api-key-here"
354
+
355
+ # Directory bookmarks (persistent)
356
+ @marks = {"h" => "/home/user", "d" => "/home/user/Documents"}
357
+
358
+ # Command history (persistent)
359
+ @history = ["git status", "ls -la"]
360
+
361
+ # Interactive programs whitelist
362
+ @interactive = "htop,vim,emacs,nano"
363
+
364
+ # Top line background colors by path match
365
+ @topmatch = [["projects", 165], ["", 238]]
555
366
  ```
556
- Likewise, you can add or rewrite any keys in RTFM and add new functionality to
557
- RTFM by following the instructions in `keys.rb`:
367
+
368
+ ### Color Customization
369
+
370
+ ```ruby
371
+ # Bottom pane
372
+ @bottomcolor = 238
373
+
374
+ # Command mode
375
+ @cmdcolor = 24
376
+
377
+ # Ruby mode
378
+ @rubycolor = 52
379
+
380
+ # OpenAI chat
381
+ @aicolor = 17
558
382
  ```
559
- # ~/.rtfm/keys.rb
560
- #
561
- # Override or add key bindings simply by assigning into KEYMAP
562
- # and defining the corresponding handler methods.
563
- #
564
- # Syntax:
565
- # KEYMAP['X'] = :my_handler
566
- #
567
- # def my_handler(chr)
568
- # # anything you like - use @pB, @pR, Dir.pwd, etc.
569
- # @pB.say("You pressed X!")
570
- # end
571
- #
383
+
384
+ ---
385
+
386
+ ## Plugins
387
+
388
+ RTFM supports two types of plugins in `~/.rtfm/plugins/`:
389
+
390
+ ### 1. Preview Handlers (`preview.rb`)
391
+
392
+ Add custom file type previews:
393
+
394
+ ```ruby
395
+ # ~/.rtfm/plugins/preview.rb
396
+
397
+ # Syntax: ext1, ext2 = command with @s placeholder
398
+ # @s is replaced with shell-escaped filename
399
+
572
400
  # Examples:
573
- #
574
- # # remap 'C' to show config
575
- # KEYMAP['C'] = :show_config
576
- #
577
- # # add a new binding: 'Z'
578
- # KEYMAP['Z'] = :zap_all
579
- # def zap_all(_chr)
580
- # @pB.say("ZAPPED!")
581
- # end
401
+ txt, log = bat -n --color=always @s
402
+ md = pandoc @s -t plain
403
+ pdf = pdftotext -f 1 -l 4 @s -
404
+ json = jq . @s
582
405
  ```
583
- Here is another example of what you could add as a plugin:
584
- ```
585
- KEYMAP['C-G'] = :git_update
586
406
 
587
- def git_update
588
- @pR.say("Updating...")
407
+ ### 2. Custom Key Bindings (`keys.rb`)
408
+
409
+ Add or override key bindings:
410
+
411
+ ```ruby
412
+ # ~/.rtfm/plugins/keys.rb
413
+
414
+ # Add new key binding
415
+ KEYMAP['Z'] = :my_custom_action
416
+
417
+ def my_custom_action(_chr)
418
+ @pB.say("Custom action triggered!")
419
+ # Use @pL, @pR, @selected, etc.
420
+ end
421
+
422
+ # Git commit shortcut example
423
+ KEYMAP['C-G'] = :git_commit
424
+
425
+ def git_commit
589
426
  message = @pCmd.ask('Commit message: ', '')
590
427
  shellexec("git add . && git commit -m '#{message}' && git push")
591
- @pB.full_refresh
592
428
  end
593
429
  ```
594
- If you're launching external terminal programs (like editors or TUI applications) from your custom keys,
595
- make sure to set `@external_program_running = true` before launching and `false` after it returns.
596
- This prevents RTFM from redrawing over your program when switching terminals:
430
+
431
+ ### Available Variables
432
+
433
+ | Variable | Description |
434
+ |----------|-------------|
435
+ | `@pT` | Top pane (info bar) |
436
+ | `@pL` | Left pane (file list) |
437
+ | `@pR` | Right pane (preview) |
438
+ | `@pB` | Bottom pane (status) |
439
+ | `@pCmd` | Command prompt |
440
+ | `@selected` | Currently selected file/dir |
441
+ | `@tagged` | Array of tagged items |
442
+ | `@external_program_running` | Set true when launching TUI programs |
443
+
444
+ ### Plugin Helper Functions
445
+
597
446
  ```ruby
598
- def custom_handler
599
- if @selected&.end_with?('.ext')
600
- @external_program_running = true # Prevent SIGWINCH interference
601
- system('stty sane < /dev/tty')
602
- system('clear < /dev/tty > /dev/tty')
603
- Cursor.show
604
- system("my_program #{Shellwords.escape(@selected)}")
605
- @external_program_running = false # Re-enable SIGWINCH handling
606
- # Restore terminal for RTFM
607
- system('stty raw -echo isig < /dev/tty')
608
- $stdin.raw!
609
- $stdin.echo = false
610
- Cursor.hide
611
- Rcurses.clear_screen
612
- refresh
613
- render
614
- end
615
- end
447
+ # Capture command output
448
+ output = command("ls -la", timeout: 5)
449
+
450
+ # Run command, show errors
451
+ shell("mv file1 file2", background: false)
452
+
453
+ # Run and show both stdout/stderr in right pane
454
+ shellexec("grep -r pattern .")
455
+ ```
456
+
457
+ ---
458
+
459
+ ## Image Display
460
+
461
+ RTFM uses the [termpix](https://github.com/isene/termpix) gem for modern multi-protocol image display.
462
+
463
+ ### Supported Protocols
464
+
465
+ | Terminal | Protocol | Status |
466
+ |----------|----------|--------|
467
+ | urxvt | w3m | ✓ Perfect |
468
+ | xterm | Sixel | ✓ Perfect |
469
+ | mlterm | Sixel | ✓ Perfect |
470
+ | kitty | w3m | ✓ Works (brief flash) |
471
+ | foot | Sixel | ✓ Perfect |
472
+
473
+ ### Features
474
+
475
+ - **EXIF orientation** - Phone photos display correctly
476
+ - **Auto-detection** - Best protocol for your terminal
477
+ - **Aspect ratio** - Images never stretched
478
+ - **Toggle** - Press `_` to toggle image preview
479
+ - **Copy to clipboard** - Press `Ctrl-y` on image
480
+
481
+ ### Terminal Compatibility
482
+
483
+ Best image experience with: urxvt, xterm, mlterm, Eterm
484
+
485
+ ---
486
+
487
+ ## RTFM vs Ranger
488
+
489
+ | Feature | RTFM | Ranger |
490
+ |---------|------|--------|
491
+ | **Language** | Pure Ruby | Python |
492
+ | **Size** | ~6K lines (single file) | ~22K lines (modular) |
493
+ | **License** | Unlicense (public domain) | GPL v3 |
494
+ | **LS_COLORS** | Native parsing | Requires theming |
495
+ | **Remote SSH/SFTP** | ✓ Built-in | ✗ |
496
+ | **Undo System** | ✓ Comprehensive | Limited |
497
+ | **Trash Bin** | ✓ With restore | ✗ |
498
+ | **OpenAI Integration** | ✓ | ✗ |
499
+ | **Permission/Ownership Undo** | ✓ | ✗ |
500
+ | **Image Protocols** | Sixel + w3m | Various (ueberzug, kitty) |
501
+ | **Tab Management** | ✓ Enhanced | ✓ Basic |
502
+ | **Bulk Rename** | ✓ Patterns | ✓ |
503
+ | **Plugin System** | Ruby-based | Python-based |
504
+ | **Community** | Small | Large (16.6k stars) |
505
+ | **Documentation** | Growing | Extensive |
506
+
507
+ **Philosophy:**
508
+ - **Ranger**: Minimalistic, "do one thing well"
509
+ - **RTFM**: Feature-packed, "jam packed with features"
510
+
511
+ **Best for:**
512
+ - **RTFM**: Power users wanting SSH workflows, undo, AI integration, maximum features
513
+ - **Ranger**: Users wanting clean, minimal, well-documented VIM-style navigation
514
+
515
+ ---
516
+
517
+ ## Documentation
518
+
519
+ - **Man page**: `man rtfm`
520
+ - **Interactive help**: Press `?` in RTFM
521
+ - **GitHub**: https://github.com/isene/RTFM
522
+ - **Changelog**: See [CHANGELOG.md](CHANGELOG.md)
523
+ - **Issues/Bugs**: https://github.com/isene/RTFM/issues
524
+
525
+ ### Additional Guides
526
+
527
+ - [Getting Started](docs/getting-started.md) - Installation, first run, basic operations
528
+ - [Configuration Guide](docs/configuration.md) - Complete settings reference
529
+ - [Remote Browsing](docs/remote-browsing.md) - SSH/SFTP workflows
530
+ - [Plugin Development](docs/plugins.md) - Extend RTFM with custom handlers
531
+
532
+ ---
533
+
534
+ ## Screenshots
535
+
536
+ ![RTFM in action](img/screenshot-logo.png)
537
+
538
+ **Keyboard Cheat Sheet:**
539
+
540
+ ![RTFM keyboard reference](img/rtfm-kb.png)
541
+
542
+ ---
543
+
544
+ ## Latest Updates
545
+
546
+ ### Version 7.3 Highlights
547
+
548
+ - **Modern image display** with termpix gem (Sixel + w3m protocols)
549
+ - **Performance optimizations** for large images
550
+ - **UTF-16 file support** for opening in $EDITOR
551
+ - **Image clipboard copy** (Ctrl-y)
552
+ - **Persistent selection** after operations
553
+
554
+ ### Version 7.2 - BREAKING CHANGE
555
+
556
+ **Batch operations** now use consistent "tagged OR selected" logic:
557
+ - Tagged items exist → operate ONLY on tagged
558
+ - No tagged items → operate on selected
559
+
560
+ **Migration:** Explicitly tag selected item with `t` if you want it included.
561
+
562
+ See [CHANGELOG.md](CHANGELOG.md) for complete version history.
563
+
564
+ ---
565
+
566
+ ## How It Works
567
+
568
+ RTFM is a two-pane file manager with enhanced tab support:
569
+
570
+ - **Left pane**: Directory/file list with navigation
571
+ - **Right pane**: Preview, info, command output
572
+ - **Top bar**: Current path and file metadata
573
+ - **Bottom bar**: Status, prompts, commands
574
+ - **Tab indicator**: `[2/5]` shows current tab position
575
+
576
+ **Tab Features:**
577
+ - Multiple tabs for multi-directory management
578
+ - Duplicate tabs (`}`) to copy directory context
579
+ - Rename tabs (`{`) for organization
580
+ - Quick switch with number keys (1-9)
581
+
582
+ **Enhanced UX:**
583
+ - VIM-style navigation (hjkl)
584
+ - Arrow key support
585
+ - Persistent bookmarks and tagged items
586
+ - Command history across sessions
587
+ - Comprehensive undo for safety
588
+
589
+ ---
590
+
591
+ ## First Run
592
+
593
+ On first launch, RTFM:
594
+ 1. Shows welcome message
595
+ 2. Adds `r` function to your shell (~/.bashrc, ~/.zshrc)
596
+ 3. Creates `~/.rtfm/` directory
597
+ 4. Generates plugin templates
598
+
599
+ The `r` function lets you:
600
+ - Launch RTFM with single key
601
+ - Exit into RTFM's current directory (not launch directory)
602
+
603
+ **Workflow:**
604
+ ```bash
605
+ r # Launch RTFM
606
+ # Navigate to desired directory
607
+ q # Exit RTFM
608
+ pwd # You're in RTFM's last directory!
609
+ r # Back into RTFM
616
610
  ```
617
- ***With this, you can mold RTFM to fit your needs better.***
618
-
619
- When writing plugins, there are a few variables you should know:
620
-
621
- Variable | Description
622
- ----------|------------------------------------------------------------------
623
- @pT | Top pane (info bar)
624
- @pL | Left pane
625
- @pR | Right pane
626
- @pB | Bottom pane (status bar)
627
- @pCmd | Command pane (asking for commands to execute)
628
- @pSearch | Search pane (prompting for what to search for)
629
- @pAI | Pane for interacting with (Open)AI
630
- @pRuby | Ruby debug/command pane
631
- @selected | The selected item in the Left pane
632
- @external_program_running | Set to true when launching terminal programs to prevent SIGWINCH from redrawing RTFM
633
-
634
- Here are three importan hook-ins to use with your plugins:
635
-
636
- ### Summary of overlap & choice
637
- - **Use `command`** when you need to _capture_ output as a value (and optionally handle stderr yourself).
638
- - **Use `shell`** for fire-and-forget side-effects where you don't care about stdout but still want error reporting.
639
- - **Use `shellexec`** when you want both stdout and stderr printed into RTFM's Right pane automatically.
640
-
641
- #### `command(cmd, timeout: 5, return_both: false) → String or [stdout, stderr]`
642
- - **What it does:** Runs `bash -c cmd`, captures both stdout and stderr, enforces a timeout.
643
- - **When to use:** Programmatically grab output (and optionally errors) of a shell command (e.g. building directory listings or previews).
644
- - **Key points:**
645
- - By default prints stderr into the Right pane and returns stdout.
646
- - `return_both: true` returns `[stdout, stderr]` instead of auto-printing errors.
647
- - Times out after `timeout` seconds, killing the process if necessary.
648
-
649
- #### `shell(cmd, background: false, err: nil) → nil`
650
- - **What it does:** Fires off `cmd` via `system`, redirecting stderr into a log file (default: `$TMP/rtfm_err.log`), optionally in the background.
651
- - **When to use:** Run side-effecting commands (e.g. `xdg-open`, `mv`) where you don't need stdout but still want error reporting.
652
- - **Key points:**
653
- - If `background: true`, runs `cmd &`.
654
- - Any stderr output is read from the log and shown via `@pR.say`.
655
- - Doesn't return command output, errors only.
656
-
657
- #### `shellexec(cmd, timeout: 10) → nil`
658
- - **What it does:** A thin wrapper over `command(cmd, timeout:, return_both: true)` that _always_ prints both stdout and stderr into the Right pane.
659
- - **When to use:** Run a command and echo both its stdout and any errors back to the user—e.g. interactive grep, locate, or other one-off shell tools.
660
- - **Key points:**
661
- - Internally calls `command(..., return_both: true)`.
662
- - Prints stderr first, then stdout.
663
- - Doesn't return anything to the caller.
664
-
665
- ## Screencast
666
- Here's a screencast for an early version of RTFM, but it shows the basic stuff:
667
- [![RTFM screencast](/img/screenshot.png)](https://youtu.be/ANUOlDryUng)
611
+
612
+ ---
613
+
614
+ ## Why RTFM?
615
+
616
+ Created to solve a specific problem: file managers should parse LS_COLORS natively instead of requiring separate themes.
617
+
618
+ **The Origin Story:**
619
+
620
+ While working on a [complete LS_COLORS setup](https://github.com/isene/LS_COLORS), I realized creating a matching ranger theme was redundant. File managers should respect terminal colors by default.
621
+
622
+ This became RTFM - a file manager that parses LS_COLORS automatically.
623
+
624
+ **Why Rewrite?**
625
+
626
+ The old curses library was clumsy. So I created [rcurses](https://github.com/isene/rcurses) - a modern, pure Ruby curses implementation. From v5 onwards, RTFM runs on rcurses, providing:
627
+ - Better stability
628
+ - Cleaner code
629
+ - More features
630
+ - Active development
631
+
632
+ ---
668
633
 
669
634
  ## Development
670
- I don't expect this program to be used by others. I do this for my own
671
- enjoyment and because I want a file manager that fits my needs better than any
672
- others I have found. If you come up with a feature request I feel is cool, I
673
- may include it. Bug reports are always welcome.
674
-
675
- A note to developers: You can hit the "@" key to enter the Ruby debug mode
676
- where anything you enter in the bottom command bar will be sent to the Ruby
677
- eval() function and output to the right pane. You can for instance issue
678
- `puts @searched` to see the currently active search pattern.
635
+
636
+ ### For Users
637
+
638
+ Bug reports and feature requests welcome at: https://github.com/isene/RTFM/issues
639
+
640
+ ### For Developers
641
+
642
+ **Ruby Debug Mode:**
643
+ Press `@` to enter Ruby REPL mode. Execute arbitrary Ruby code:
644
+ ```ruby
645
+ # Examples:
646
+ puts @selected # Show current selection
647
+ puts @tagged.inspect # Show tagged items
648
+ puts @marks # Show bookmarks
649
+ ```
650
+
651
+ **Plugin Development:**
652
+ See `~/.rtfm/plugins/` directory for templates and examples.
653
+
654
+ **Contributing:**
655
+ This is a personal project built for my needs. Cool feature requests may be included. Code contributions welcome via pull requests.
656
+
657
+ ---
658
+
659
+ ## Author
660
+
661
+ **Geir Isene**
662
+ - Email: g@isene.com
663
+ - Web: https://isene.com
664
+ - GitHub: https://github.com/isene
665
+
666
+ ## License
667
+
668
+ **Unlicense** - Public Domain
669
+
670
+ Permission granted to use, copy, modify, distribute, and sell this software for any purpose without restriction.
671
+
672
+ ---
673
+
674
+ ## See Also
675
+
676
+ - [rcurses](https://github.com/isene/rcurses) - Pure Ruby curses library
677
+ - [termpix](https://github.com/isene/termpix) - Terminal image display gem
678
+ - [ranger](https://github.com/ranger/ranger) - Python-based file manager
679
+ - [LS_COLORS](https://github.com/isene/LS_COLORS) - Comprehensive terminal color setup
680
+
681
+ ---
682
+
683
+ **Stay Amazing** ✓