rtfm-filemanager 3.35 → 4.01

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +29 -6
  3. data/bin/rtfm +14 -11
  4. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0a892c0b31de7364c8aeec3885b9cd5433980dbc7666d298ec9d97e99317e09
4
- data.tar.gz: e522a3e276571a98bf39dad000374623bc61d0c17a0fdf62568fa2aa904f734f
3
+ metadata.gz: 8debb87d4b97ede214c7d3585f6dbc2de4bc908e6f601410247dca689368afcc
4
+ data.tar.gz: b8c357bdde901e97ef110fac7bfbc1c7ad4e49c43631cd61bbe83ad0a0ae7ae2
5
5
  SHA512:
6
- metadata.gz: 775672ef173c569f193cf8f795cc3c385f72c288d0fbc24a6290958a7a7a3eb24f0e67e3a54a54fe7bb56e6162dbbc176c0881635eabd03ab4dbb642b6841dfb
7
- data.tar.gz: 4fc0c15e5e7c4e1f0172b3c54457c3e04f567dae7369c6ccccb90ad2ba40c4635d45872bfb9acee35098b696e60d0db95a863796e624d96a7727e7ad077f6476
6
+ metadata.gz: 1ac88a4682a1259b445b4f0b399cb2492bf1a6d217e7f4c38ecda2607530147c5d527d06f3224c23a83fab645803f17cd74524f394763a6f895d39bd7e0d9927
7
+ data.tar.gz: 72bb39e0a4fe632064eeb237d00fd8025824b44c354ef91cf193a7039f535d0bb9d326fef7522e3e38da0e94b6d17ad5ff99e3905ea171a519e4cc203d994414
data/README.md CHANGED
@@ -5,7 +5,6 @@
5
5
  What other features can I cram into this file manager?
6
6
 
7
7
  ## What?
8
-
9
8
  <img src="img/logo.jpg" align="left" width="150" height="150"> RTFM is a
10
9
  terminal file manager jam packed with features.
11
10
 
@@ -17,8 +16,8 @@ much more.
17
16
  Note: RTFM (Ruby Terminal File Manager) works best with the (u)rxvt, xterm and
18
17
  Eterm terminal emulators.
19
18
 
20
- ## Features
21
19
 
20
+ ## Features
22
21
  RTFM is one of the more feature rich terminal file managers. Some of the
23
22
  features are:
24
23
 
@@ -48,6 +47,8 @@ features are:
48
47
  * Show comprehensive system info (processes running, disk space, dmesg, etc.)
49
48
  * See if a directory (with sub dirs) has changed using cryptographic hashes
50
49
  * Integration with OpenAI to get an executive summary of file content
50
+ * Possibility to change top line background when matching a path
51
+
51
52
 
52
53
  ## Why?
53
54
  RTFM parses your LS_COLORS to ensure color consistency with the terminal experience.
@@ -60,6 +61,7 @@ should parse LS_COLORS as default rather than implement their own themes. This
60
61
  became an itch that I kept scratching until I could happily replace ranger two
61
62
  weeks later.
62
63
 
64
+
63
65
  ## How?
64
66
  RTFM is a two-pane file manager. You navigate in the left pane and the content
65
67
  of the selected item (directory or file) is shown in the right pane. The right
@@ -77,8 +79,8 @@ complete directories and file names and ENTER to issue the command, while
77
79
  Ctrl-u deletes the line. Issuing ENTER on a blank line has no effect. Use
78
80
  Ctrl-g to leave the command bar without executing anything.
79
81
 
80
- ## Installation
81
82
 
83
+ ## Installation
82
84
  You can install RTFM by coloning this repo and put the file `rtfm` in your
83
85
  "bin" directory. Or you can simply run `gem install rtfm-filemanager`.
84
86
 
@@ -123,12 +125,12 @@ sudo apt install ruby-full git libncurses-dev x11-utils xdotool bat poppler-util
123
125
  gem install rtfm-filemanager
124
126
  ```
125
127
 
126
- ## Screenshot
127
128
 
129
+ ## Screenshot
128
130
  ![RTFM screenshot](img/screenshot.png)
129
131
 
130
- ## Image preview in the terminal
131
132
 
133
+ ## Image preview in the terminal
132
134
  RTFM uses w3mimgdisplay (part of the w3m package) to show images in the
133
135
  terminal. Some terminals have an issue with this - either the images don't
134
136
  show, the previous image is not cleared (new image overlaps the previous) or
@@ -155,7 +157,6 @@ qterminal | X | |
155
157
 
156
158
 
157
159
  ## Keys
158
-
159
160
  These are the set of keys to move around and do actions within RTFM:
160
161
 
161
162
  ### Basic keys
@@ -269,9 +270,11 @@ Ctrl-d | Create a new directory (a shortcut for ":mkdir ")
269
270
  Ctrl-n | Invoke navi (see https://github.com/denisidoro/navi) with any output in right pane
270
271
  S | Show comprehensive system info (system, CPU, filesystem, latest dmesg messages)
271
272
 
273
+
272
274
  ## Keyboard cheat sheet
273
275
  ![RTFM keyboard cheat sheet](img/rtfm-kb.png)
274
276
 
277
+
275
278
  ## First run
276
279
  The first time you run RTFM, you are greeted with a welcome message. RTFM will
277
280
  then create a file (`.rtfm.launch`) in your home directory that will let you
@@ -348,6 +351,26 @@ square brackets at the end of the top info line. Image files will have the
348
351
  size of the image included while pdf files will have the number of pages. More
349
352
  file specific information will be included when I feel like adding such.
350
353
 
354
+
355
+ ## Top line background color when matching a path
356
+ You can set the variable `@topmatch` in your `.rtfm.conf` so that it will change
357
+ the background color of the top line/pane when you are in a directory matching
358
+ a pattern.
359
+
360
+ Example:
361
+ ```
362
+ @topmatch = [["passionfruit", 165], ["dualog", 50], ["", 238]]
363
+ ```
364
+ With this, the background color of the top line/pane will be set to `165` if
365
+ you are in a directory path that includes "passionfruits". The last pair is
366
+ the default background color when no match is found. If you don't set this
367
+ variable in your `.rtfm.conf`, rtfm will set this value to:
368
+ ```
369
+ @topmatch = [["", 238]]
370
+ ```
371
+ Make sure to have a default value set as the last pair in `@topmatch`.
372
+
373
+
351
374
  ## Screencast
352
375
  [![RTFM screencast](/img/screenshot-logo.png)](https://youtu.be/ANUOlDryUng)
353
376
 
data/bin/rtfm CHANGED
@@ -14,7 +14,7 @@
14
14
  # for any damages resulting from its use. Further, I am under no
15
15
  # obligation to maintain or extend this software. It is provided
16
16
  # on an 'as is' basis without any expressed or implied warranty.
17
- @version = "3.35" # Added number of items tagged
17
+ @version = "4.01" # Added possibility to change top line background when matching a path
18
18
 
19
19
  # PRELIMINARIES
20
20
  @help = <<HELPTEXT
@@ -115,7 +115,7 @@ ADDITIONAL COMMANDS
115
115
  Ctrl-n = Invoke navi (see https://github.com/denisidoro/navi) with any output in right window
116
116
  S = Show comprehensive System info (system, CPU, filesystem, latest dmesg messages)
117
117
 
118
- COPYRIGHT: Geir Isene, 2020-4. No rights reserved. See http://isene.com for more.
118
+ COPYRIGHT: Geir Isene, 2020-5. No rights reserved. See http://isene.com for more.
119
119
  HELPTEXT
120
120
  def firstrun
121
121
  @firstrun = <<~FIRSTRUN
@@ -251,10 +251,11 @@ begin # BASIC SETUP
251
251
  @history = [] # Initialize the command line history array
252
252
  @rubyhistory = [] # Initialize the command line history array for ruby commands
253
253
  @border = false
254
+ @topmatch = [["", 249]]
254
255
  @preview = true
255
256
  @runmailcap = false # Set to 'true' in .rtfm.conf if you want to use run-mailcap instead of xdg-open
256
257
  @batuse = true # Use batcat for syntax highlighting
257
- @aimodel = "gpt-3.5-turbo-instruct" # The default OpenAI model, set another in .rtfm.conf if you like
258
+ @aimodel = "gpt-4o-mini" # The default OpenAI model, set another in .rtfm.conf if you like
258
259
  ## These are automatically written on exit
259
260
  @marks = {} # Initialize (book)marks hash
260
261
  @hash = {} # Initialize the sha directory hashing
@@ -660,9 +661,11 @@ def main_getkey # GET KEY FROM USER
660
661
  w_b_info(err.to_s)
661
662
  end
662
663
  when 'c' # Change/rename selected @selected
663
- cmd = w_b_getstr(": ", "mv \"#{@selected}\" \"#{@selected}\"")
664
- el1 = cmd.sub(/mv \"(.*)\" \"(.*)\"/, '\1')
665
- el2 = cmd.sub(/mv \"(.*)\" \"(.*)\"/, '\2')
664
+ @selected.length > 12 ? source = @selected[0...12] + "…" : source = @selected
665
+ cmd = w_b_getstr(": ", "mv \"#{source}\" \"#{@selected}\"")
666
+ el1 = @selected_safe
667
+ el2 = cmd.split(' "').last[0..-2]
668
+ cmd = "mv #{el1} \"#{el2}\""
666
669
  begin
667
670
  if el1 == el2
668
671
  w_b_info(" Source and target are the same. No action done.")
@@ -672,7 +675,7 @@ def main_getkey # GET KEY FROM USER
672
675
  rescue StandardError => err
673
676
  w_b_info(err.to_s)
674
677
  end
675
- @w_r.update = true
678
+ @w_r.update = false
676
679
  when 'C-O' # Change ownerships
677
680
  require 'etc'
678
681
  gnm = Etc.getgrgid(File.stat(@selected).gid).name
@@ -1002,7 +1005,7 @@ def get_files(win) # The core of the directory listings
1002
1005
  ls_cmd = "ls 2>/dev/null #{@lsbase} #{@lsall} #{@lsorder} #{@lsinvert} #{@lsuser}" # Get files in current directory
1003
1006
  ls_cmd += @selected_safe if win == "right"
1004
1007
  @cfiles = `#{ls_cmd} --color`.split("\n")
1005
- @files = @cfiles.map {|f| f.sub(/^.*\d+m(.+)\e\[0m/, '\1')}
1008
+ @files = @cfiles.map {|f| f.sub(/^.*\d+m(.+)\e\[0m/, '\1').gsub(/\e\[K/, "")}
1006
1009
  ls_cmd += " -H " if win == "right"
1007
1010
  ls_cmd += %q[ -lh --time-style="long-iso" | awk '{printf "%s%s%s%11s%6s%6s", $1, " " $3, ":" $4,$6,$7,$5"\n"}']
1008
1011
  @fspes = `#{ls_cmd}`.split("\n").drop(1)
@@ -1102,7 +1105,7 @@ def list_dir(active) # LIST CONTENT OF A DIRECTORY (BOTH active AND RIGHT WINDOW
1102
1105
  base_length = base_name.length
1103
1106
  ext_name = File.extname(str)
1104
1107
  ext_length = ext_name.length
1105
- nbl = win.maxx - 5 - ext_length # nbl: new_base_length
1108
+ nbl = win.maxx - 6 - ext_length # nbl: new_base_length
1106
1109
  nbl -= 1 if dir != "" # Account for one extra character
1107
1110
  nbl -= 1 if link != "" # Account for one extra character
1108
1111
  str = base_name[0..nbl] + "…" + ext_name
@@ -1144,10 +1147,8 @@ def open_selected(html = nil) # OPEN SELECTED ITEM (when pressing RIGHT)
1144
1147
  system("exec $EDITOR #{@selected_safe}")
1145
1148
  else
1146
1149
  if @runmailcap
1147
- #Thread.new { system("run-mailcap #{@selected_safe} 2>/dev/null") }
1148
1150
  system("run-mailcap #{@selected_safe} 2>/dev/null &")
1149
1151
  else
1150
- #Thread.new { system("xdg-open #{@selected_safe} 2>/dev/null") }
1151
1152
  system("xdg-open #{@selected_safe} 2>/dev/null &")
1152
1153
  end
1153
1154
  end
@@ -1706,6 +1707,8 @@ loop do # OUTER LOOP - CATCHING REFRESHES VIA 'r'
1706
1707
  @index = 0
1707
1708
  end
1708
1709
  end
1710
+ dir_path = Dir.pwd.downcase
1711
+ @w_t.bg = @topmatch.find { |name, _| name == "" || dir_path.include?(name.downcase) }&.last
1709
1712
  dir_old = Dir.pwd
1710
1713
  @index = 0 if @index == nil
1711
1714
  index_old = @index
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rtfm-filemanager
3
3
  version: !ruby/object:Gem::Version
4
- version: '3.35'
4
+ version: '4.01'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-16 00:00:00.000000000 Z
11
+ date: 2025-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses
@@ -47,7 +47,8 @@ dependencies:
47
47
  description: 'A full featured terminal browser with syntax highlighted files, images
48
48
  shown in the terminal, videos thumbnailed, etc. You can bookmark and jump around
49
49
  easily, delete, rename, copy, symlink and move files. RTFM has a a wide range of
50
- other features. New in 3.35: Added number of items tagged.'
50
+ other features. New in 4.01: Added possibility to change top line background when
51
+ matching a path.'
51
52
  email: g@isene.com
52
53
  executables:
53
54
  - rtfm