rtfm-filemanager 4.10 → 5

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.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +278 -166
  3. data/bin/rtfm +2063 -1657
  4. data/img/logo.png +0 -0
  5. data/img/rtfm-kb.png +0 -0
  6. metadata +22 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4bf6a35e53012d1b241e532428162d89f2e752ef49819e004fce339ed68101a
4
- data.tar.gz: afdebc972d821da361803eebc02237da7d3f609675b13c85f4ea89ec8f601e73
3
+ metadata.gz: 6057bc9ae7f88f3b05029fe3de2529d72279620808f04e040de4ae38844d31e4
4
+ data.tar.gz: ade554a33f58d9ac4543a9582f8f5aa707a2a18ebd76822c19b6ec4e15d175a2
5
5
  SHA512:
6
- metadata.gz: 95703e3225c805f66562674c3fbde24bea9064caa5f0698a621d07ad12134edc467fad1499eedfd35f78f60345f01b6f3050946f942004145cffada42d5d27d3
7
- data.tar.gz: a9c6851cdd211ca14478d708d4d783adcc71598c73882827a4d8a5b92c18749d86be3f6161c5a754f753fa37cf8c4e1c81e29eb804cfa2eae14f504d31a2d3c8
6
+ metadata.gz: da784ee1fedec71ef87abcec3760a5cec1ec803938123556982c860894ace9ed7076fefefe153ca60c37c06c7291c89a5c1111f06fde429bbedf1d5f5c14b1f0
7
+ data.tar.gz: f599aa1dd8d1b70977655bd9a2c655f19517c3ef9897eda78e2aa8197674a4343f4bbd22b6829641e18fe09f019b00787a2fd85d1103541a31b45612d91c1ee5
data/README.md CHANGED
@@ -2,10 +2,21 @@
2
2
 
3
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)
4
4
 
5
- What other features can I cram into this file manager?
5
+ ## Version 5
6
+
7
+ Version 5 is a complete rewrite of RTFM using
8
+ [rcurses](https://github.com/isene/rcurses) as the underlying library. With
9
+ this, RTFM gains more stability, higher quality code and more features.
10
+
11
+ Among the new version 5 features are an optional trash bin, advanced OpenAI
12
+ integrations, plugin architectures for keybindings, user defined features and
13
+ file viewers. You also get better feedback, better visuals, more error
14
+ capture. Plenty.
15
+
16
+ The major feature additions in v5 are marked in ***bold italic***.
6
17
 
7
18
  ## What?
8
- <img src="img/logo.jpg" align="left" width="150" height="150"> RTFM is a
19
+ <img src="img/logo.png" align="left" width="150" height="150"> RTFM is a
9
20
  terminal file manager jam packed with features.
10
21
 
11
22
  Apart from viewing and manipulating directories, you get syntax highlighting
@@ -16,81 +27,76 @@ much more.
16
27
  Note: RTFM (Ruby Terminal File Manager) works best with the (u)rxvt, xterm and
17
28
  Eterm terminal emulators.
18
29
 
19
-
20
- ## Features
21
- RTFM is one of the more feature rich terminal file managers. Some of the
30
+ ### Features
31
+ RTFM is one of the most feature rich terminal file managers. Some of the
22
32
  features are:
23
33
 
24
- * RTFM shows images inline in the terminal (can be turned off)
34
+ * RTFM parses your LS_COLORS to ensure color consistency with the terminal experience
35
+ * Images are shown inline in the terminal (can be turned off)
25
36
  * File contents is shown with proper syntax highlighting
26
37
  * Item's meta data is shown at the top
27
- * Easily browse file content (even pdf, MS/OpenOffice, etc.)
28
- * Move around the file systems using arrow keys of VI keys
29
- * Copy, move, rename or delete files easily
30
- * Create symlinks with just one key stroke
38
+ * Easily browse file content (pdf, MS/OpenOffice, etc.)
39
+ * Move around the file systems using arrow keys or VI keys
40
+ * Copy, move, rename, symlink and delete files easily
41
+ * Simply use 'r' in your terminal to launch RTFM - and exit into the directory where you ended RTFM
42
+ * ***Toggle the use of a "trash bin" to move dirs/files there instead of deleting***
31
43
  * Easily copy an item's path to clipboard or primary selection
32
- * Order items the way you want
33
- * See only files of a certain type
44
+ * Order items the way you want, see only files of a certain type
34
45
  * Filter out all files not matching a [regex](https://www.rubyguides.com/2015/06/ruby-regex/) pattern
35
46
  * Mark files and directories and do group actions on them
36
47
  * Bookmark directories for easy jumping
37
48
  * Follow a symlink to where it points with one key stroke
38
49
  * Highlight files and directories matching a given pattern
39
50
  * Find items using `locate` and jump directly to the desired item
40
- * Find items and jump there using fuzzy search (uses [fzf](https://github.com/junegunn/fzf))
41
- * Execute any shell command from inside RTFM
51
+ * Find items and jump there using fuzzy search (with [fzf](https://github.com/junegunn/fzf))
52
+ * Execute any shell command from inside RTFM - ***incuding other curses applications***
42
53
  * [navi](https://github.com/denisidoro/navi) integration for easier command executions
43
54
  * Easily unpack or create archives
44
55
  * Show git status for the current directory
45
56
  * Show comprehensive system info (processes running, disk space, dmesg, etc.)
46
57
  * See if a directory (with sub dirs) has changed using cryptographic hashes
47
58
  * Integration with OpenAI to get an executive summary of file content
59
+ * ***OpenAI chat integrated; Discuss files, content, commands with OpenAI***
48
60
  * Possibility to change top line background when matching a path
49
-
61
+ * Theming of pane colors
50
62
 
51
63
  ## Why?
52
- RTFM parses your LS_COLORS to ensure color consistency with the terminal experience.
53
-
54
64
  The idea came to mind as I was working on [a complete LS_COLORS
55
65
  setup](https://github.com/isene/LS_COLORS) with a corresponding
56
66
  [ranger](https://ranger.github.io/) theme. But making a separate theme for
57
67
  ranger to mimic a massive LS_COLOR setup is rather stupid. File managers
58
68
  should parse LS_COLORS as default rather than implement their own themes. This
59
69
  became an itch that I kept scratching until I could happily replace ranger two
60
- weeks later.
61
-
70
+ weeks later. But, coding RTFM based on the old curses library was clumsy,
71
+ inefficient and painful. So I decided to create
72
+ [rcurses](https://github.com/isene/rcurses) - a complete curses library
73
+ written from scratch in pure Ruby - and from v5 and onwards, RTFM is based
74
+ completely on this modern curses implementation.
62
75
 
63
76
  ## How?
64
77
  RTFM is a two-pane file manager. You navigate in the left pane and the content
65
78
  of the selected item (directory or file) is shown in the right pane. The right
66
79
  pane is also used to show information such as the currently tagged items, your
67
- (book)marks, output from commands, etc.
80
+ (book)marks, output from commands, error messages, etc.
68
81
 
69
82
  When you start RTFM, you can supply a directory path as an argument to let
70
- RTFM start up in that directory.
83
+ RTFM start up in that directory. When you exit it exits into the current RTFM
84
+ directory.
71
85
 
72
86
  You can run any command in the bottom "command bar" and have the output
73
- presented in the right pane. Use LEFT and RIGHT keys to go back and forth on
74
- the command line, HOME to beginning of line, END to end of line, Backspace or
75
- Ctrl-h to delete previous character, Ctrl-w to delete previous word, TAB to
76
- complete directories and file names and ENTER to issue the command, while
77
- Ctrl-u deletes the line. Issuing ENTER on a blank line has no effect. Use
78
- Ctrl-g to leave the command bar without executing anything.
79
-
87
+ presented in the right pane. History of commands are preserved like in your
88
+ shell.
80
89
 
81
90
  ## Installation
82
- You can install RTFM by coloning this repo and put the file `rtfm` in your
83
- "bin" directory. Or you can simply run `gem install rtfm-filemanager`.
91
+ You can install RTFM by cloning this repo and put the file `rtfm` in your
92
+ "bin" directory. If you do, you need to install
93
+ [rcurses](https://github.com/isene/rcurses) first.
94
+
95
+ Or you can simply run `gem install rtfm-filemanager`.
84
96
 
85
97
  There are two basic prerequisites needed: `x11-utils` and `xdotool`. On
86
98
  Ubuntu these would be installed via `apt install x11-utils xdotool`.
87
99
 
88
- In order to run RTFM (without generating [a bunch of
89
- warnings](https://github.com/isene/RTFM/issues/1)), you need to do a `gem
90
- install curses` (gets version 1.3.2) instead of installing via `apt install
91
- ruby-curses` (gets version 1.2.4-1build1 on Ubuntu 20.04). If you install RTFM
92
- via `gem install rtfm-filemanager`, this dependency is already taken care of.
93
-
94
100
  Content of text files are handled by `cat` - or by `bat` if you want beautiful
95
101
  highlighting. Other files are shown via external programs (Debian/Ubuntu
96
102
  family of Linux distros command in last column):
@@ -98,6 +104,7 @@ family of Linux distros command in last column):
98
104
  File type | Requirements | Installation
99
105
  ----------------------------|----------------------------------|-------------------------------
100
106
  Syntax highlighting of text | `bat` | `apt install bat`
107
+ Markdown | `pandoc` | `apt install pandoc`
101
108
  PDFs | `pdftotext` | `apt install poppler-utils`
102
109
  LibreOffice | `odt2txt` | `apt install odt2txt`
103
110
  MS docx | `docx2txt` | `apt install docx2txt`
@@ -110,8 +117,8 @@ Video (thumbnails) | `ffmpegthumbnailer` | `apt install ff
110
117
  Install rtfm from scratch with all of the above on Ubuntu:
111
118
  ```
112
119
  sudo apt update
113
- sudo apt install ruby-full git libncurses-dev x11-utils xdotool bat poppler-utils odt2txt docx2txt catdoc w3m imagemagick ffmpegthumbnailer
114
- sudo gem install curses
120
+ sudo apt install ruby-full git libncurses-dev x11-utils xdotool bat pandoc poppler-utils odt2txt docx2txt unzip gnumeric catdoc w3m imagemagick ffmpegthumbnailer
121
+ sudo gem install rcurses
115
122
  git clone https://github.com/isene/RTFM
116
123
  cd RTFM
117
124
  sudo cp rtfm /usr/bin/
@@ -119,13 +126,12 @@ sudo cp rtfm /usr/bin/
119
126
  Or with a simpler gem install:
120
127
  ```
121
128
  sudo apt update
122
- sudo apt install ruby-full git libncurses-dev x11-utils xdotool bat poppler-utils odt2txt docx2txt catdoc w3m imagemagick ffmpegthumbnailer
129
+ sudo apt install ruby-full git libncurses-dev x11-utils xdotool bat pandoc poppler-utils odt2txt docx2txt unzip gnumeric catdoc w3m imagemagick ffmpegthumbnailer
123
130
  gem install rtfm-filemanager
124
131
  ```
125
132
 
126
-
127
133
  ## Screenshot
128
- ![RTFM screenshot](img/screenshot.png)
134
+ ![RTFM screenshot](img/screenshot-logo.png)
129
135
 
130
136
 
131
137
  ## Image preview in the terminal
@@ -157,158 +163,189 @@ qterminal | X | |
157
163
  ## Keys
158
164
  These are the set of keys to move around and do actions within RTFM:
159
165
 
160
- ### Basic keys
161
-
162
- Key | Description
163
- -------|------------------------------------------------------------------
164
- ? | Show this help text
165
- r | Refresh RTFM (recreates the panes. Use on terminal resize or when there is garbage somewhere)
166
- R | Reload configuration (~/.rtfm.conf)
167
- W | Write parameters to ~/.rtfm.conf (@lsall, @lslong, @lsorder, @lsinvert, @border, @width, @preview, @tagged, @marks)
168
- q | Quit
169
- Q | QUIT (without writing changes to the config file)
170
- v | Display RTFM version in bottom command bar
166
+ ### Basic keys
167
+ Key | Description
168
+ ---------|------------------------------------------------------------------
169
+ ? | Show this help text
170
+ v | Display RTFM version (and latest Gem version) in bottom window/command bar
171
+ r | Refresh RTFM (recreates all windows. Use on terminal resize or when there is garbage somewhere)
172
+ R | Reload configuration (~/.rtfm/conf)
173
+ W | Write parameters to ~/.rtfm/conf: @marks, @hash, @history, @rubyhistory, @aihistory, @lslong, @lsall, @lsorder, @lsinvert, @width, @border, @preview, @trash
174
+ C | ***Show the current configuration in ~/.rtfm/conf***
175
+ q | Quit (save basic configuration: @marks, @hash, @history, @rubyhistory, @aihistory)
176
+ Q | QUIT (without writing any changes to the config file)
177
+
178
+ ### Layout
179
+ Key | Description
180
+ ---------|------------------------------------------------------------------
181
+ w | Change the width of the left/right panes (left pane ⇒ 20%, 30%, 40%, 50%, 60%)
182
+ B | Cycle border
183
+ \- | (Minus sign) Toggle preview in right pane (turn it off for faster traversing of directories)
184
+ _ | (Underscore) Toggle preview of images in right pane
185
+ b | Toggle syntax highlighting (and line numbering)
171
186
 
172
187
  ### Motion
188
+ Key | Description
189
+ ---------|------------------------------------------------------------------
190
+ j/DOWN | Go one item down in left pane (rounds to top)
191
+ k/UP | Go one item up in left pane (rounds to bottom)
192
+ h/LEFT | Go up one directory level
193
+ 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
194
+ PgDown | Go one page down in left pane
195
+ PgUp | Go one page up in left pane
196
+ END | Go to last item in left pane
197
+ HOME | Go to first item in left pane
198
+
199
+ ### Marks and jumping
200
+ Key | Description
201
+ ---------|------------------------------------------------------------------
202
+ 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
203
+ M | Show marked items in right pane
204
+ ' | 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)
205
+ ~ | Jump to Home directory
206
+ \> | Follow symlink to the directory where the target resides
173
207
 
174
- Key | Description
175
- -----------|------------------------------------------------------------------
176
- DOWN or j | Go one item down in left pane (rounds to top)
177
- UP or k | Go one item up in left pane (rounds to bottom)
178
- LEFT or h | Go up one directory level
179
- RIGHT or l | Enter directory or open file (using xdg-open or run-mailcap). Use the key 'x' to force open using xdg-open (or run-mailcap). Use 'x' for opening html files in a browser rather than editing the file in your text editor.
180
- PgDown | Go one page down in left pane
181
- PgUp | Go one page up in left pane
182
- END | Go to last item in left pane
183
- HOME | Go to first item in left pane
184
-
185
- ### Jumping and marks
186
-
187
- Key | Description
188
- -------|------------------------------------------------------------------
189
- 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
190
- M | Show marked items in right pane
191
- ' | 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)
192
- ~ | Jump to Home directory
193
- \> | Follow symlink to the directory where the target resides
194
-
195
- ### Searching
196
-
197
- Key | Description
198
- -------|------------------------------------------------------------------
199
- / | Enter search string in bottom command bar to highlight matching items and jump to the first match
200
- \\ | Remove search pattern
201
- n | Jump to the next item matched by '/'
202
- N | Jump to the previous item matched by '/'
203
- g | Run 'grep' to show files that contains the MATCH in current directory
204
- L | Start 'locate' search for files, then use '#' to jump to desired line/directory
205
- Ctrl-l | Locate files via fzf from the current directory down (fuzzy file finder must be installed https://github.com/junegunn/fzf)
208
+ ### Directory views
209
+ Key | Description
210
+ ---------|------------------------------------------------------------------
211
+ a | Show all (also hidden) items
212
+ A | Show long info per item (show item attributes)
213
+ o | Change the order/sorting of directories (circular toggle)
214
+ i | Invert/reverse the sorting
215
+ O | Show the Ordering in the bottom window (the full ls command)
206
216
 
207
217
  ### Tagging
208
-
209
- Key | Description
210
- -------|------------------------------------------------------------------
211
- t | Tag item (toggles)
212
- Ctrl-t | Add items matching a pattern to list of tagged items (Ctrl-t and then . will tag all items)
213
- T | Show currently tagged items in right pane
214
- u | Untag all tagged items
218
+ Key | Description
219
+ ---------|------------------------------------------------------------------
220
+ t | Tag item (toggles)
221
+ Ctrl-t | Add items matching a pattern to list of tagged items (Ctrl-t and then . will tag all items)
222
+ T | Show currently tagged items in right pane
223
+ u | Untag all tagged items
215
224
 
216
225
  ### Manipulate items
217
-
218
- Key | Description
219
- -------|------------------------------------------------------------------
220
- p | Put (copy) tagged items here
221
- P | PUT (move) tagged items here
222
- s | Create symlink to tagged items here
223
- d | Delete selected item and tagged items. Press 'y' to confirm
224
- c | Change/rename selected (adds the proper command to change in the command bar)
225
- Ctrl-o | Change ownership to user:group of selected and tagged items
226
- Ctrl-p | Change permissions of selected and tagged items. Format = rwxr-xr-x or 755 or rwx (applies the trio to user, group and others)
227
- z | Extract tagged zipped archive to current directory
228
- Z | Create zipped archive from tagged files/directories
229
-
230
- ### Directory views
231
-
232
- Key | Description
233
- -------|------------------------------------------------------------------
234
- a | Show all (also hidden) items
235
- A | Show All info per item (show item attributes)
236
- o | Change the order/sorting of directories (circular toggle)
237
- i | Invert/reverse the sorting
238
- O | Show the Ordering in the bottom command bar (the full ls command)
239
- G | Show git status for current directory
240
- 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
241
- 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. If RTFM is installed as a gem, the ruby-openai gem is included in the installation
242
-
243
- ### Right pane
244
-
245
- Key | Description
246
- -------|------------------------------------------------------------------
247
- ENTER | Refresh the right pane
248
- TAB | Next page of the preview (if doc long and ∇ in the bottom right)
249
- S-TAB | Previous page (if you have moved down the document first - ∆ in the top right)
250
- w | Change the width of the left/right panes (left pane ⇒ 20%, 30%, 40%, 50%, 60%)
251
- \- | Toggle preview in right pane (turn it off for faster traversing of directories)
252
- _ | Toggle preview of images in right pane
253
- b | Toggle syntax highlighting (and line numbering)
254
-
255
- ### Additional commands
256
-
257
- Key | Description
258
- -------|------------------------------------------------------------------
259
- f | Show only files in the left pane matching extension(s) (e.g. "txt" or "pdf,png,jpg")
260
- F | Show only files matching a pattern (Ruby Regex) (e.g. "abc" or "ab.+12(\w3)+")
261
- B | Toggle border
262
- : | Enter "command mode" in bottom command bar (press ENTER to execute, press Ctrl-G to escape)
263
- ; | Show command history in right pane
264
- y | Copy path of selected item to primary selection (for pasting with middle mouse button)
265
- Y | Copy path of selected item to clipboard
266
- Ctrl-y | Copy content of right pane to clipboard
267
- Ctrl-d | Create a new directory (a shortcut for ":mkdir ")
268
- Ctrl-n | Invoke navi (see https://github.com/denisidoro/navi) with any output in right pane
269
- S | Show comprehensive system info (system, CPU, filesystem, latest dmesg messages)
226
+ Key | Description
227
+ ---------|------------------------------------------------------------------
228
+ p | Put (copy) tagged items here
229
+ P | PUT (move) tagged items here
230
+ c | Change/rename selected (adds command to bottom window)
231
+ s | Create symlink to tagged items here
232
+ d | Delete selected item and tagged items. Confirm with 'y'. ***Moves items to trash directory (~/.rtfm/trash/) if @trash | true***
233
+ D | ***Empty trash directory***
234
+ Ctrl-d | ***Toggle use of trash directory***
235
+ Ctrl-o | Change ownership to user:group of selected and tagged items
236
+ Ctrl-p | Change permissions of selected and tagged items
237
+ Format | rwxr-xr-x or 755 or rwx (applies the trio to user, group and others)
238
+
239
+ ### Filter and search
240
+ Key | Description
241
+ ---------|------------------------------------------------------------------
242
+ f | Show only files in the left pane matching extension(s) (e.g. "txt" or "pdf,png,jpg")
243
+ F | Show only files matching a pattern (Ruby Regex) (e.g. "abc" or "ab.+12(\w3)+")
244
+ Ctrl-f | Clear all filtering
245
+ / | Enter search string in bottom window to highlight matching items and jump to the first match
246
+ \\ | Remove search pattern
247
+ n | Jump to the next item matched by '/'
248
+ N | Jump to the previous item matched by '/'
249
+ g | Run 'grep' to show files that contains the MATCH in current directory
250
+ L | Start 'locate' search for files, then use '#' to jump to desired line/directory
251
+ Ctrl-l | Locate files via fzf from the current directory down (fuzzy file finder must be installed https://github.com/junegunn/fzf)
252
+
253
+ ### Archives
254
+ Key | Description
255
+ ---------|------------------------------------------------------------------
256
+ z | Extract tagged zipped archive to current directory
257
+ Z | Create zipped archive from tagged files/directories
258
+
259
+ ### Git/hash/openai
260
+ Key | Description
261
+ ---------|------------------------------------------------------------------
262
+ G | Show git status for current directory
263
+ 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
264
+ 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.
265
+ 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***
266
+
267
+ ### Right pane controls
268
+ Key | Description
269
+ ---------|------------------------------------------------------------------
270
+ ENTER | Refresh the right pane
271
+ S-RIGHT | ***One line down in the preview***
272
+ S-LEFT | ***One line up in the preview***
273
+ S-DOWN | ***Next page of the preview (if doc long and in the bottom right)*** (TAB does the same)
274
+ S-UP | ***Previous page (if you have moved down the document first - ∆ in the top right)*** (or S-TAB)
275
+
276
+ ### Clipboard copy
277
+ Key | Description
278
+ ---------|------------------------------------------------------------------
279
+ y | Copy path of selected item to primary selection (for pasting with middle mouse button)
280
+ Y | Copy path of selected item to clipboard
281
+ Ctrl-y | Copy content of right pane to clipboard (turn off batcat syntax highlighting with 'b' for a clean copy of content)
282
+
283
+ ### System shortcuts
284
+ Key | Description
285
+ ---------|------------------------------------------------------------------
286
+ S | Show comprehensive System info (system, CPU, filesystem, latest dmesg messages)
287
+ = | Create a new directory (a shortcut for ":mkdir ")
288
+ Ctrl-n | Invoke navi (see https://github.com/denisidoro/navi) with any output in right window
289
+
290
+ ### Command mode
291
+ Key | Description
292
+ ---------|------------------------------------------------------------------
293
+ : | 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)
294
+ ; | Show command history in right pane
295
+ \+ | ***Add program(s) to the list of full-UI interactive terminal programs***
296
+
297
+
298
+ ### Ruby debug mode
299
+ Key | Description
300
+ ---------|------------------------------------------------------------------
301
+ @ | Enter Ruby mode to execute any Ruby command (ENTER to execute, ESC to escape)
270
302
 
271
303
 
272
304
  ## Keyboard cheat sheet
273
305
  ![RTFM keyboard cheat sheet](img/rtfm-kb.png)
274
306
 
275
-
276
307
  ## First run
277
308
  The first time you run RTFM, you are greeted with a welcome message. RTFM will
278
- then create a file (`.rtfm.launch`) in your home directory that will let you
279
- launch RTFM via the one key command `r`. It also lets RTFM exit in the
309
+ add a simple function to your shell (bash, zsh, fish, maybe others) that will
310
+ let you launch RTFM via the one key command `r`. It also lets RTFM exit in the
280
311
  directory you are currently in (inside of RTFM) rather than where you launched
281
312
  RTFM.
282
313
 
283
314
  With this, you can jump around in your directory structure via RTFM, exit to
284
315
  the desired directory, do work in the terminal and go back into RTFM via `r`.
285
316
 
317
+ If you want to launch rtfm straight into a specified directory, do this
318
+ instead: `rtfm ~/mydir/subdir`
286
319
 
287
320
  ## Configuration file
288
321
  When you first exit RTFM, it will write your (book)marks and the set of tagged
289
- files to `.rtfm.conf`. This ensures your marks and tagged files are
322
+ files to `.rtfm/conf`. This ensures your marks and tagged files are
290
323
  persistent. It also means you can launch rtfm tag a bunch of dirs and files,
291
324
  drop out back to the terminal to do some work, back into rtfm and resume to
292
325
  work with your previously tagged items.
293
326
 
294
- You can also set persistent variables in the config file manually. At the top
295
- of `.rtfm.conf` you can set the following:
327
+ You can also set persistent variables in the config file manually:
296
328
 
297
329
  To have long info per item: `@lslong = true` (this is otherwise set to `false`)
298
330
 
299
331
  To show hidden files: `@lsall = "-a"` (this is otherwise set to `""`)
300
332
 
333
+ To set a specific order for ls: `@lsorder = "-S"` (to order by size).
334
+
335
+ To revert your ls order: `@lsinvert = "-r"`
336
+
301
337
  To set any additional 'ls' switches, set the variable `@lsuser`. To not list
302
338
  any files containg the word "test", you could do this:
303
339
  ```
304
340
  @lsuser = "--ignore=test"
305
341
  ```
342
+ To suppress image viewing in the terminal: `@showimage = false`
343
+
344
+ To suppress showing any content in the right pane: `@preview = false`
306
345
 
307
- To change the default width of the left pane to something other than ⅓rd of
308
- the terminal width: `@width = 5` (would set the left pane width to 50% of the
309
- window size).
346
+ To change the default width of the left pane: `@width = 5` (experiment with numbers 2-8).
310
347
 
311
- To add borders in RTFM: `@border = true`
348
+ To toggle borders in RTFM: `@border = 1` (any number 0-3)
312
349
 
313
350
  To have some commands already prepared for the command history, you can set:
314
351
  ```
@@ -318,18 +355,36 @@ To open files with `run-mailcap` instead of `open-xdg` set:
318
355
  ```
319
356
  @runmailcap = true
320
357
  ```
321
-
322
- These variables that you manually add to the top of the config files are
358
+ ***To use the trash bin: `@trash = true`***
359
+
360
+ ***To change the list of "whitelisted full-UI programs", change the variable @interactive.
361
+ This is a comma separated string listing all programs that can be run from
362
+ within RTFM's "command mode" (via the key `:`). Programs such as `htop`, `vim`
363
+ and all shells will take over the terminal when they run and need explicit
364
+ permission via this variable to be able to "replace" RTFM in the terminal.
365
+ When you exit such a whitelisted program, RTFM resumes control. If you try to
366
+ run such a program while it is not whitelisted, it will hang the terminal. To
367
+ add a program to the whitelist inside RTFM, press the `+` key. All ususal
368
+ shell comands that do not take over the full terminal such as `ls`, `touch`,
369
+ `neofetch`, etc. will run just fine in command mode without being whitelisted.
370
+ You can also explicitly run a program as interactive by prefixing the command
371
+ with a single `§` - e.g. `:` `§saidar`.***
372
+
373
+ All the variables above that you manually add to the top of the config files are
323
374
  undisturbed by launching and exiting RTFM.
324
375
 
325
- You can also use `W` inside of RTFM to write all the parameters mentioned
326
- above to the config file - instead of adding them manually.
376
+ You can structure the config file the way you want. Let your OCD make it pretty.
377
+
378
+ You can use `W` inside of RTFM to write all the parameters mentioned above to
379
+ the config file - instead of adding them manually. Example: You press `+` to
380
+ add `emacs` to your list of whitelisted interactive programs. Then you would
381
+ want to press `W` to update @interactive in your config file so that `emacs`
382
+ is permanently whitelisted as an interactive program for you.
327
383
 
328
384
  To exit RTFM without writing any changes to you marks or list of tagged items,
329
385
  exit with `Q`. They will then remain the same as when you launched RTFM for
330
386
  that session.
331
387
 
332
-
333
388
  ## Extra info
334
389
  The top line shows information about the currently item in the left pane. When
335
390
  you are at a file, the information is pretty self explanatory:
@@ -349,38 +404,95 @@ square brackets at the end of the top info line. Image files will have the
349
404
  size of the image included while pdf files will have the number of pages. More
350
405
  file specific information will be included when I feel like adding such.
351
406
 
352
-
353
407
  ## Top and bottom line background colors
354
408
  You can customize the background colors for the top and bottom lines/panes.
355
409
 
356
410
  Bottom color is by default `238`. Change it by setting @bottomcolor to your
357
- desired colors in your `.rtfm.conf`.
411
+ desired colors in your `.rtfm/conf`.
358
412
 
359
413
  You can also set the background color at the bottom when you enter command
360
414
  mode (via `:`) by setting @cmdcolor and the Ruby mode (via `@`) by setting
361
415
  @rubycolor.
362
416
 
363
- You can set the variable `@topmatch` in your `.rtfm.conf` so that it will change
417
+ Background color for OpenAI chats (invoked with `Ctrl-a`) is set with @aicolor.
418
+
419
+ You can set the variable `@topmatch` in your `.rtfm/conf` so that it will change
364
420
  the background color of the top line/pane when you are in a directory matching
365
421
  a pattern.
366
422
 
367
423
  Example:
368
424
  ```
369
- @topmatch = [["passionfruit", 165], ["dualog", 50], ["", 238]]
425
+ @topmatch = [["passionfruit", 165], ["kiwi", 50], ["", 238]]
370
426
  ```
371
427
  With this, the background color of the top line/pane will be set to `165` if
372
428
  you are in a directory path that includes "passionfruits". The last pair is
373
429
  the default background color when no match is found. If you don't set this
374
- variable in your `.rtfm.conf`, rtfm will set this value to:
430
+ variable in your `.rtfm/conf`, rtfm will set this value to:
375
431
  ```
376
432
  @topmatch = [["", 238]]
377
433
  ```
378
434
  Make sure to have a default value set as the last pair in `@topmatch`.
379
435
 
436
+ ## Plugin architecture
437
+ ***Upon first running RTFM, a few files are created in the `.rtfm/` directory.***
380
438
 
381
- ## Screencast
382
- [![RTFM screencast](/img/screenshot-logo.png)](https://youtu.be/ANUOlDryUng)
439
+ One is `preview.rb`, the other is `keys.rb`.
440
+
441
+ You can add new "previewers" to show files with extensions that is not
442
+ previewed by default in RTFM. The `preview.rb` explains how you add thesea:
443
+ ```
444
+ # ~/.rtfm/preview.rb
445
+ #
446
+ # Define one handler per line in the form:
447
+ #
448
+ # ext1, ext2, ext3 = command with @s placeholder
449
+ #
450
+ # @s will be replaced by the shell-escaped filename.
451
+ #
452
+ # Lines beginning with # or blank are ignored.
453
+ #
454
+ # Examples:
455
+ # # plain text, Ruby, Python, shell
456
+ # txt, rb, py, sh = bat -n --color=always @s
457
+ #
458
+ # # markdown via pandoc
459
+ # md = pandoc @s -t plain
460
+ #
461
+ # # PDFs
462
+ # pdf = pdftotext -f 1 -l 4 @s -
463
+ ```
464
+ Likewise, you can add or rewrite any keys in RTFM and add new functionality to
465
+ RTFM by following the instructions in `keys.rb`:
466
+ ```
467
+ # ~/.rtfm/keys.rb
468
+ #
469
+ # Override or add key bindings simply by assigning into KEYMAP
470
+ # and defining the corresponding handler methods.
471
+ #
472
+ # Syntax:
473
+ # KEYMAP['X'] = :my_handler
474
+ #
475
+ # def my_handler(chr)
476
+ # # anything you likebuse @pB, @pR, Dir.pwd, etc.
477
+ # @pB.say("You pressed X!")
478
+ # end
479
+ #
480
+ # Examples:
481
+ #
482
+ # # remap 'C' to show config
483
+ # KEYMAP['C'] = :show_config
484
+ #
485
+ # # add a new binding: 'Z'
486
+ # KEYMAP['Z'] = :zap_all
487
+ # def zap_all(_chr)
488
+ # @pB.say("ZAPPED!")
489
+ # end
490
+ ```
491
+ ***With this, you can mold RTFM to fit your needs better.***
383
492
 
493
+ ## Screencast
494
+ Here's a screencast for an early version of RTFM, but it shows the basic stuff:
495
+ [![RTFM screencast](/img/screenshot.png)](https://youtu.be/ANUOlDryUng)
384
496
 
385
497
  ## Development
386
498
  I don't expect this program to be used by others. I do this for my own