rtfm-filemanager 7.3.6 → 7.4.1

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,754 @@
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
+ - [OpenAI Integration](#openai-integration)
40
+ - [Plugins](#plugins)
41
+ - [Image Display](#image-display)
42
+ - [RTFM vs Ranger](#rtfm-vs-ranger)
43
+ - [Documentation](#documentation)
44
+
45
+ ---
46
+
47
+ ## Key Features
48
+
49
+ ### File Operations
50
+ - **Comprehensive undo system** - Undo delete, move, rename, copy, symlink, permissions, ownership
51
+ - **Trash bin** - Optional safe deletion with restore capability
52
+ - **Bulk operations** - Copy, move, delete multiple tagged items
53
+ - **Bulk rename** - Pattern-based renaming (regex, templates, case conversion)
54
+ - **Permission management** - Change permissions with undo support (`755`, `rwxr-xr-x`, `+x`, `-w`)
55
+ - **Ownership management** - Change user:group with undo support
56
+
57
+ ### Display & Preview
58
+ - **Syntax highlighting** - File content with bat/batcat
59
+ - **Inline images** - w3m and Sixel protocols via termpix gem
60
+ - **EXIF orientation** - Correct display of rotated images
61
+ - **Video thumbnails** - ffmpegthumbnailer integration
62
+ - **Archive preview** - View contents of .zip, .tar, .gz, .rar, .7z files
63
+ - **Document preview** - PDF, LibreOffice, MS Office files
64
+ - **LS_COLORS parsing** - Consistent terminal color theming
65
+
66
+ ### Remote Operations
67
+ - **SSH/SFTP browsing** - Navigate remote directories seamlessly
68
+ - **Interactive SSH shell** - Drop into shell sessions on remote hosts
69
+ - **File transfer** - Download and upload files
70
+ - **Connection caching** - Smart caching for performance
71
+
72
+ ### Advanced Features
73
+ - **Git integration** - Status display for repositories
74
+ - **Cryptographic hashing** - Directory tree verification
75
+ - **OpenAI integration** - File descriptions and interactive chat
76
+ - **Tab management** - Multiple tabs with duplication and renaming
77
+ - **Fuzzy search** - fzf integration
78
+ - **Navi integration** - Interactive command cheatsheets
79
+
80
+ ### Developer Features
81
+ - **Plugin architecture** - Custom preview handlers and key bindings
82
+ - **Ruby debug mode** - Execute arbitrary Ruby in context
83
+ - **Command history** - Preserved across sessions
84
+ - **Extensible** - Clean plugin API
85
+
86
+ ---
29
87
 
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.
88
+ ## Installation
31
89
 
32
- The major feature additions are marked in ***bold italic***.
90
+ ### via RubyGems (Recommended)
33
91
 
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.
92
+ ```bash
93
+ gem install rtfm-filemanager
94
+ ```
37
95
 
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.
96
+ ### Full Installation with All Features
42
97
 
43
- Note: RTFM (Ruby Terminal File Manager) works best with the (u)rxvt, xterm and
44
- Eterm terminal emulators.
98
+ #### Ubuntu/Debian:
99
+ ```bash
100
+ sudo apt update
101
+ sudo apt install ruby-full x11-utils xdotool bat pandoc poppler-utils \
102
+ odt2txt docx2txt unzip gnumeric catdoc w3m imagemagick \
103
+ ffmpegthumbnailer tar gzip bzip2 xz-utils unrar p7zip-full
45
104
 
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:**
105
+ gem install rtfm-filemanager
106
+ ```
107
+
108
+ #### macOS:
131
109
  ```bash
132
- # Basic SSH connection
133
- user@server.com:/path/to/directory
110
+ brew install ruby imagemagick w3m bat pandoc poppler
134
111
 
135
- # With custom SSH key
136
- -i ~/.ssh/custom-key user@server.com:/path
112
+ gem install rtfm-filemanager
113
+ ```
137
114
 
138
- # SSH URI format
139
- ssh://user@server.com/path/to/directory
115
+ ### Dependencies
140
116
 
141
- # Key at end format
142
- user@server.com:/path -i ~/.ssh/custom-key
117
+ **Required:**
118
+ - Ruby 2.7+
119
+ - rcurses gem (~> 6.0)
120
+ - termpix gem (~> 0.2)
143
121
 
144
- # With comments for organization
145
- user@server.com:/path # Production server
146
- admin@192.168.1.10 # Local development
147
- ```
122
+ **Optional (for full functionality):**
123
+ - **ImageMagick** - Image preview (`identify`, `convert`)
124
+ - **w3m-img** - w3m image protocol
125
+ - **xdotool** - Image redraw on workspace switching
126
+ - **bat/batcat** - Syntax highlighting
127
+ - **fzf** - Fuzzy file finding
128
+ - **pandoc** - Document conversion
129
+ - **ffmpegthumbnailer** - Video thumbnails
130
+ - **ruby-openai** - AI integration
148
131
 
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
132
+ ---
156
133
 
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.
134
+ ## Keyboard Reference
158
135
 
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
- ```
136
+ For complete reference: `man rtfm` or press `?` in RTFM
137
+
138
+ ### Essential Keys
139
+
140
+ | Key | Action |
141
+ |-----|--------|
142
+ | `?` | Show help |
143
+ | `q` | Quit (save config) |
144
+ | `Q` | Quit (don't save) |
145
+ | `r` | Refresh display |
146
+
147
+ ### Navigation
148
+
149
+ | Key | Action |
150
+ |-----|--------|
151
+ | `j` / `↓` | Move down |
152
+ | `k` / `↑` | Move up |
153
+ | `h` / `←` | Parent directory |
154
+ | `l` / `→` / `ENTER` | Enter directory / open file |
155
+ | `HOME` / `END` | First / last item |
156
+ | `PgUp` / `PgDn` | Page up / down |
204
157
 
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)
158
+ ### Marks & Jumping
159
+
160
+ | Key | Action |
161
+ |-----|--------|
162
+ | `m` + letter | Set bookmark |
163
+ | `'` + letter | Jump to bookmark |
164
+ | `~` | Jump to home |
165
+ | `>` | Follow symlink |
166
+ | `Ctrl-r` | Recent files/directories |
167
+ | `Ctrl-e` | Toggle remote SSH mode |
288
168
 
289
169
  ### 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
170
 
427
- To suppress showing any content in the right pane: `@preview = false`
171
+ | Key | Action |
172
+ |-----|--------|
173
+ | `t` | Tag/untag item |
174
+ | `Ctrl-t` | Tag by pattern |
175
+ | `T` | Show tagged items |
176
+ | `u` | Untag all |
177
+
178
+ ### File Operations
179
+
180
+ | Key | Action |
181
+ |-----|--------|
182
+ | `p` | Copy tagged items here |
183
+ | `P` | Move tagged items here |
184
+ | `s` | Create symlinks |
185
+ | `c` | Rename item |
186
+ | `E` | Bulk rename (patterns) |
187
+ | `d` | Delete (→ trash if enabled) |
188
+ | `D` | Empty trash |
189
+ | `Ctrl-d` | Toggle trash on/off |
190
+ | `U` | Undo last operation |
191
+
192
+ ### Permissions
193
+
194
+ | Key | Action |
195
+ |-----|--------|
196
+ | `Ctrl-p` | Change permissions (with undo) |
197
+ | `Ctrl-o` | Change ownership (with undo) |
198
+
199
+ **Permission formats:** `755`, `rwxr-xr-x`, `rwx`, `+x`, `-w`, `+rw`
200
+
201
+ ### Search & Filter
202
+
203
+ | Key | Action |
204
+ |-----|--------|
205
+ | `f` | Filter by extension |
206
+ | `F` | Filter by regex |
207
+ | `/` | Search and highlight |
208
+ | `n` / `N` | Next / previous match |
209
+ | `g` | Grep content |
210
+ | `L` | Locate files |
211
+ | `Ctrl-l` | Fuzzy find (fzf) |
212
+
213
+ ### Display
214
+
215
+ | Key | Action |
216
+ |-----|--------|
217
+ | `-` | Toggle preview on/off |
218
+ | `_` | Toggle image preview |
219
+ | `b` | Toggle syntax highlighting |
220
+ | `w` | Change pane width |
221
+ | `B` | Cycle borders |
222
+ | `a` | Show/hide hidden files |
223
+ | `A` | Toggle long info (ls -l) |
224
+ | `o` | Change sort order |
225
+ | `i` | Invert sort |
226
+
227
+ ### Clipboard
228
+
229
+ | Key | Action |
230
+ |-----|--------|
231
+ | `y` | Copy path (primary selection) |
232
+ | `Y` | Copy path (clipboard) |
233
+ | `Ctrl-y` | Copy image/text to clipboard |
234
+
235
+ ### Git / AI / System
236
+
237
+ | Key | Action |
238
+ |-----|--------|
239
+ | `G` | Git status |
240
+ | `H` | Directory hash |
241
+ | `I` | OpenAI file description |
242
+ | `Ctrl-a` | OpenAI chat |
243
+ | `S` | System information |
244
+ | `X` | Compare two files |
245
+ | `e` | File properties |
246
+
247
+ ### Tabs
248
+
249
+ | Key | Action |
250
+ |-----|--------|
251
+ | `]` | New tab |
252
+ | `[` | Close tab |
253
+ | `J` / `K` | Previous / next tab |
254
+ | `}` | Duplicate tab |
255
+ | `{` | Rename tab |
256
+ | `1-9` | Switch to tab # |
257
+
258
+ ### Command Mode
259
+
260
+ | Key | Action |
261
+ |-----|--------|
262
+ | `:` | Execute shell command |
263
+ | `;` | Command history |
264
+ | `@` | Ruby debug mode |
265
+ | `§` | Force interactive mode (prefix) |
266
+ | `+` | Whitelist program as interactive |
267
+
268
+ **Interactive mode example:** `:§htop` - runs htop in full terminal
269
+
270
+ ---
271
+
272
+ ## Remote SSH/SFTP Browsing
273
+
274
+ Access and manage files on remote servers directly from RTFM.
275
+
276
+ ### Activating Remote Mode
277
+
278
+ 1. Press `Ctrl-e`
279
+ 2. Enter connection string:
280
+ ```
281
+ user@server.com:/path/to/directory
282
+ ```
283
+
284
+ ### Connection Formats
428
285
 
429
- To change the default width of the left pane: `@width = 5` (experiment with numbers 2-8).
286
+ ```bash
287
+ # Basic SSH
288
+ user@server.com:/path
430
289
 
431
- To toggle borders in RTFM: `@border = 1` (any number 0-3)
290
+ # Custom SSH key
291
+ -i ~/.ssh/custom-key user@server.com:/path
432
292
 
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]]
293
+ # SSH URI
294
+ ssh://user@server.com/path
295
+
296
+ # With comment
297
+ user@server.com:/path # Production server
518
298
  ```
519
- Make sure to have a default value set as the last pair in `@topmatch`.
520
299
 
521
- ## Plugin architecture
522
- ***Upon first running RTFM, a few files are created in the `.rtfm/` directory.***
300
+ ### Remote Mode Keys
301
+
302
+ | Key | Action |
303
+ |-----|--------|
304
+ | `←` / `h` | Parent directory |
305
+ | `→` / `ENTER` | Enter dir / show file info |
306
+ | `d` | Download file |
307
+ | `u` | Upload tagged files |
308
+ | `s` | Open SSH shell |
309
+ | `Ctrl-e` | Exit remote mode |
310
+
311
+ **Visual indicator:** Red background when in remote mode
312
+
313
+ ---
314
+
315
+ ## Configuration
523
316
 
524
- One is `preview.rb`, the other is `keys.rb`.
317
+ Configuration stored in `~/.rtfm/conf`
525
318
 
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:
319
+ ### Quick Config
320
+
321
+ | Action | Command |
322
+ |--------|---------|
323
+ | View config | Press `C` |
324
+ | Save config | Press `W` |
325
+ | Reload config | Press `R` |
326
+
327
+ ### Common Settings
328
+
329
+ ```ruby
330
+ # ~/.rtfm/conf
331
+
332
+ # Enable trash bin
333
+ @trash = true
334
+
335
+ # Toggle preview on/off
336
+ @preview = true
337
+
338
+ # Show/hide images
339
+ @showimage = true
340
+
341
+ # Show hidden files
342
+ @lsall = "-a"
343
+
344
+ # Show long file info
345
+ @lslong = true
346
+
347
+ # Pane width (2-7)
348
+ @width = 5
349
+
350
+ # Border style (0-3)
351
+ @border = 2
352
+
353
+ # OpenAI API key
354
+ @ai = "your-api-key-here"
355
+
356
+ # Directory bookmarks (persistent)
357
+ @marks = {"h" => "/home/user", "d" => "/home/user/Documents"}
358
+
359
+ # Command history (persistent)
360
+ @history = ["git status", "ls -la"]
361
+
362
+ # Interactive programs whitelist
363
+ @interactive = "htop,vim,emacs,nano"
364
+
365
+ # Top line background colors by path match
366
+ @topmatch = [["projects", 165], ["", 238]]
528
367
  ```
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 -
368
+
369
+ ### Color Customization
370
+
371
+ ```ruby
372
+ # Bottom pane
373
+ @bottomcolor = 238
374
+
375
+ # Command mode
376
+ @cmdcolor = 24
377
+
378
+ # Ruby mode
379
+ @rubycolor = 52
380
+
381
+ # OpenAI chat
382
+ @aicolor = 17
555
383
  ```
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`:
384
+
385
+ ---
386
+
387
+ ## OpenAI Integration
388
+
389
+ RTFM includes built-in AI features powered by OpenAI's API for intelligent file analysis and interactive assistance.
390
+
391
+ ### Setup
392
+
393
+ 1. **Install the ruby-openai gem:**
394
+ ```bash
395
+ gem install ruby-openai
396
+ ```
397
+
398
+ 2. **Get an API key:**
399
+ - Sign up at https://platform.openai.com/
400
+ - Generate an API key from your account settings
401
+
402
+ 3. **Configure RTFM:**
403
+ Add your API key to `~/.rtfm/conf`:
404
+ ```ruby
405
+ @ai = "sk-your-actual-api-key-here"
406
+ @aimodel = "gpt-4o-mini" # Optional: default model
407
+ @aicolor = 17 # Optional: chat pane background color
408
+ ```
409
+
410
+ ### Features
411
+
412
+ #### File Description (Press `I`)
413
+
414
+ Get an intelligent summary of any file or directory:
415
+ - **Files:** Purpose, code review (for source files), library documentation lookup
416
+ - **Directories:** Overview of structure and contents
417
+ - **Git-aware:** Includes recent changes if in a git repository
418
+ - **Smart analysis:** Automatically includes preview content for context
419
+
420
+ Example uses:
421
+ - Understand unfamiliar codebases quickly
422
+ - Get code review suggestions (bugs, style, improvements)
423
+ - Learn what libraries/APIs are being used
424
+ - See git diff explanations in plain language
425
+
426
+ #### Interactive Chat (Press `Ctrl-a`)
427
+
428
+ Start a conversational AI assistant specialized in:
429
+ - File and directory questions
430
+ - Shell command help and suggestions
431
+ - Terminal workflow assistance
432
+ - Programming and scripting guidance
433
+
434
+ The chat maintains context throughout your RTFM session, so follow-up questions work naturally.
435
+
436
+ ### Configuration Options
437
+
438
+ ```ruby
439
+ # Model selection (in ~/.rtfm/conf)
440
+ @aimodel = "gpt-4o-mini" # Fast, cost-effective (default)
441
+ @aimodel = "gpt-4o" # More capable, higher cost
442
+ @aimodel = "gpt-4-turbo" # Alternative high-end model
443
+
444
+ # Chat interface color
445
+ @aicolor = 17 # Dark blue background (default)
558
446
  ```
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
- #
447
+
448
+ ### Cost & Privacy
449
+
450
+ - API calls cost money (typically $0.001-0.01 per request with gpt-4o-mini)
451
+ - File contents are sent to OpenAI when using `I` key
452
+ - No data is sent unless you explicitly press `I` or `Ctrl-a`
453
+ - Chat history persists only during your RTFM session
454
+
455
+ ---
456
+
457
+ ## Plugins
458
+
459
+ RTFM supports two types of plugins in `~/.rtfm/plugins/`:
460
+
461
+ ### 1. Preview Handlers (`preview.rb`)
462
+
463
+ Add custom file type previews:
464
+
465
+ ```ruby
466
+ # ~/.rtfm/plugins/preview.rb
467
+
468
+ # Syntax: ext1, ext2 = command with @s placeholder
469
+ # @s is replaced with shell-escaped filename
470
+
572
471
  # 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
582
- ```
583
- Here is another example of what you could add as a plugin:
472
+ txt, log = bat -n --color=always @s
473
+ md = pandoc @s -t plain
474
+ pdf = pdftotext -f 1 -l 4 @s -
475
+ json = jq . @s
584
476
  ```
585
- KEYMAP['C-G'] = :git_update
586
477
 
587
- def git_update
588
- @pR.say("Updating...")
478
+ ### 2. Custom Key Bindings (`keys.rb`)
479
+
480
+ Add or override key bindings:
481
+
482
+ ```ruby
483
+ # ~/.rtfm/plugins/keys.rb
484
+
485
+ # Add new key binding
486
+ KEYMAP['Z'] = :my_custom_action
487
+
488
+ def my_custom_action(_chr)
489
+ @pB.say("Custom action triggered!")
490
+ # Use @pL, @pR, @selected, etc.
491
+ end
492
+
493
+ # Git commit shortcut example
494
+ KEYMAP['C-G'] = :git_commit
495
+
496
+ def git_commit
589
497
  message = @pCmd.ask('Commit message: ', '')
590
498
  shellexec("git add . && git commit -m '#{message}' && git push")
591
- @pB.full_refresh
592
499
  end
593
500
  ```
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:
501
+
502
+ ### Available Variables
503
+
504
+ | Variable | Description |
505
+ |----------|-------------|
506
+ | `@pT` | Top pane (info bar) |
507
+ | `@pL` | Left pane (file list) |
508
+ | `@pR` | Right pane (preview) |
509
+ | `@pB` | Bottom pane (status) |
510
+ | `@pCmd` | Command prompt |
511
+ | `@selected` | Currently selected file/dir |
512
+ | `@tagged` | Array of tagged items |
513
+ | `@external_program_running` | Set true when launching TUI programs |
514
+
515
+ ### Plugin Helper Functions
516
+
597
517
  ```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
518
+ # Capture command output
519
+ output = command("ls -la", timeout: 5)
520
+
521
+ # Run command, show errors
522
+ shell("mv file1 file2", background: false)
523
+
524
+ # Run and show both stdout/stderr in right pane
525
+ shellexec("grep -r pattern .")
526
+ ```
527
+
528
+ ---
529
+
530
+ ## Image Display
531
+
532
+ RTFM uses the [termpix](https://github.com/isene/termpix) gem for modern multi-protocol image display.
533
+
534
+ ### Supported Protocols
535
+
536
+ | Terminal | Protocol | Status |
537
+ |----------|----------|--------|
538
+ | urxvt | w3m | ✓ Perfect |
539
+ | xterm | Sixel | ✓ Perfect |
540
+ | mlterm | Sixel | ✓ Perfect |
541
+ | kitty | w3m | ✓ Works (brief flash) |
542
+ | foot | Sixel | ✓ Perfect |
543
+
544
+ ### Features
545
+
546
+ - **EXIF orientation** - Phone photos display correctly
547
+ - **Auto-detection** - Best protocol for your terminal
548
+ - **Aspect ratio** - Images never stretched
549
+ - **Toggle** - Press `_` to toggle image preview
550
+ - **Copy to clipboard** - Press `Ctrl-y` on image
551
+
552
+ ### Terminal Compatibility
553
+
554
+ Best image experience with: urxvt, xterm, mlterm, Eterm
555
+
556
+ ---
557
+
558
+ ## RTFM vs Ranger
559
+
560
+ | Feature | RTFM | Ranger |
561
+ |---------|------|--------|
562
+ | **Language** | Pure Ruby | Python |
563
+ | **Size** | ~6K lines (single file) | ~22K lines (modular) |
564
+ | **License** | Unlicense (public domain) | GPL v3 |
565
+ | **LS_COLORS** | Native parsing | Requires theming |
566
+ | **Remote SSH/SFTP** | ✓ Built-in | ✗ |
567
+ | **Undo System** | ✓ Comprehensive | Limited |
568
+ | **Trash Bin** | ✓ With restore | ✗ |
569
+ | **OpenAI Integration** | ✓ | ✗ |
570
+ | **Permission/Ownership Undo** | ✓ | ✗ |
571
+ | **Image Protocols** | Sixel + w3m | Various (ueberzug, kitty) |
572
+ | **Tab Management** | ✓ Enhanced | ✓ Basic |
573
+ | **Bulk Rename** | ✓ Patterns | ✓ |
574
+ | **Plugin System** | Ruby-based | Python-based |
575
+ | **Community** | Small | Large (16.6k stars) |
576
+ | **Documentation** | Growing | Extensive |
577
+
578
+ **Philosophy:**
579
+ - **Ranger**: Minimalistic, "do one thing well"
580
+ - **RTFM**: Feature-packed, "jam packed with features"
581
+
582
+ **Best for:**
583
+ - **RTFM**: Power users wanting SSH workflows, undo, AI integration, maximum features
584
+ - **Ranger**: Users wanting clean, minimal, well-documented VIM-style navigation
585
+
586
+ ---
587
+
588
+ ## Documentation
589
+
590
+ - **Man page**: `man rtfm`
591
+ - **Interactive help**: Press `?` in RTFM
592
+ - **GitHub**: https://github.com/isene/RTFM
593
+ - **Changelog**: See [CHANGELOG.md](CHANGELOG.md)
594
+ - **Issues/Bugs**: https://github.com/isene/RTFM/issues
595
+
596
+ ### Additional Guides
597
+
598
+ - [Getting Started](docs/getting-started.md) - Installation, first run, basic operations
599
+ - [Configuration Guide](docs/configuration.md) - Complete settings reference
600
+ - [Remote Browsing](docs/remote-browsing.md) - SSH/SFTP workflows
601
+ - [Plugin Development](docs/plugins.md) - Extend RTFM with custom handlers
602
+
603
+ ---
604
+
605
+ ## Screenshots
606
+
607
+ ![RTFM in action](img/screenshot-logo.png)
608
+
609
+ **Keyboard Cheat Sheet:**
610
+
611
+ ![RTFM keyboard reference](img/rtfm-kb.png)
612
+
613
+ ---
614
+
615
+ ## Latest Updates
616
+
617
+ ### Version 7.3 Highlights
618
+
619
+ - **Modern image display** with termpix gem (Sixel + w3m protocols)
620
+ - **Performance optimizations** for large images
621
+ - **UTF-16 file support** for opening in $EDITOR
622
+ - **Image clipboard copy** (Ctrl-y)
623
+ - **Persistent selection** after operations
624
+
625
+ ### Version 7.2 - BREAKING CHANGE
626
+
627
+ **Batch operations** now use consistent "tagged OR selected" logic:
628
+ - Tagged items exist → operate ONLY on tagged
629
+ - No tagged items → operate on selected
630
+
631
+ **Migration:** Explicitly tag selected item with `t` if you want it included.
632
+
633
+ See [CHANGELOG.md](CHANGELOG.md) for complete version history.
634
+
635
+ ---
636
+
637
+ ## How It Works
638
+
639
+ RTFM is a two-pane file manager with enhanced tab support:
640
+
641
+ - **Left pane**: Directory/file list with navigation
642
+ - **Right pane**: Preview, info, command output
643
+ - **Top bar**: Current path and file metadata
644
+ - **Bottom bar**: Status, prompts, commands
645
+ - **Tab indicator**: `[2/5]` shows current tab position
646
+
647
+ **Tab Features:**
648
+ - Multiple tabs for multi-directory management
649
+ - Duplicate tabs (`}`) to copy directory context
650
+ - Rename tabs (`{`) for organization
651
+ - Quick switch with number keys (1-9)
652
+
653
+ **Enhanced UX:**
654
+ - VIM-style navigation (hjkl)
655
+ - Arrow key support
656
+ - Persistent bookmarks and tagged items
657
+ - Command history across sessions
658
+ - Comprehensive undo for safety
659
+
660
+ ---
661
+
662
+ ## First Run
663
+
664
+ On first launch, RTFM:
665
+ 1. Shows welcome message
666
+ 2. Adds `r` function to your shell (~/.bashrc, ~/.zshrc)
667
+ 3. Creates `~/.rtfm/` directory
668
+ 4. Generates plugin templates
669
+
670
+ The `r` function lets you:
671
+ - Launch RTFM with single key
672
+ - Exit into RTFM's current directory (not launch directory)
673
+
674
+ **Workflow:**
675
+ ```bash
676
+ r # Launch RTFM
677
+ # Navigate to desired directory
678
+ q # Exit RTFM
679
+ pwd # You're in RTFM's last directory!
680
+ r # Back into RTFM
616
681
  ```
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)
682
+
683
+ ---
684
+
685
+ ## Why RTFM?
686
+
687
+ Created to solve a specific problem: file managers should parse LS_COLORS natively instead of requiring separate themes.
688
+
689
+ **The Origin Story:**
690
+
691
+ 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.
692
+
693
+ This became RTFM - a file manager that parses LS_COLORS automatically.
694
+
695
+ **Why Rewrite?**
696
+
697
+ 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:
698
+ - Better stability
699
+ - Cleaner code
700
+ - More features
701
+ - Active development
702
+
703
+ ---
668
704
 
669
705
  ## 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.
706
+
707
+ ### For Users
708
+
709
+ Bug reports and feature requests welcome at: https://github.com/isene/RTFM/issues
710
+
711
+ ### For Developers
712
+
713
+ **Ruby Debug Mode:**
714
+ Press `@` to enter Ruby REPL mode. Execute arbitrary Ruby code:
715
+ ```ruby
716
+ # Examples:
717
+ puts @selected # Show current selection
718
+ puts @tagged.inspect # Show tagged items
719
+ puts @marks # Show bookmarks
720
+ ```
721
+
722
+ **Plugin Development:**
723
+ See `~/.rtfm/plugins/` directory for templates and examples.
724
+
725
+ **Contributing:**
726
+ This is a personal project built for my needs. Cool feature requests may be included. Code contributions welcome via pull requests.
727
+
728
+ ---
729
+
730
+ ## Author
731
+
732
+ **Geir Isene**
733
+ - Email: g@isene.com
734
+ - Web: https://isene.com
735
+ - GitHub: https://github.com/isene
736
+
737
+ ## License
738
+
739
+ **Unlicense** - Public Domain
740
+
741
+ Permission granted to use, copy, modify, distribute, and sell this software for any purpose without restriction.
742
+
743
+ ---
744
+
745
+ ## See Also
746
+
747
+ - [rcurses](https://github.com/isene/rcurses) - Pure Ruby curses library
748
+ - [termpix](https://github.com/isene/termpix) - Terminal image display gem
749
+ - [ranger](https://github.com/ranger/ranger) - Python-based file manager
750
+ - [LS_COLORS](https://github.com/isene/LS_COLORS) - Comprehensive terminal color setup
751
+
752
+ ---
753
+
754
+ **Stay Amazing** ✓