rtfm-filemanager 1.7.4 → 1.8.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/rtfm +35 -15
  3. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4bf04ac71f0e3cfc2c028dfc50ed8db7c85855a5c1292b3ae3f5f1f3ae1f2cfa
4
- data.tar.gz: 58871496975eac0839a8b43793b6fc75303705754fcfce5dd362f4b9dff9b37f
3
+ metadata.gz: c06c860c6a58770b3899d93cbfd71b5f16b4ad635acfc083ab3e68df036b4e42
4
+ data.tar.gz: 7ee9845c3f0e713f05277853c862bf468b52c56ed4d192e1078bfe5ae38f5508
5
5
  SHA512:
6
- metadata.gz: 83160f2faa5b44caca7df16b0b2e6fafdc043da42eb376db0c1ec28e3cc38330aa53ff1d803e2bca64a0912528b5f41fbe51c976b7a02b9cca1a495591115932
7
- data.tar.gz: 27264dc09670b0b5fbb031cd595b85eca494d72183003628e97a32319ed43049a8add382ce320e7796696d6c4b80e0f559c9f9e31ac9cd501db9324d8229a00a
6
+ metadata.gz: 250153cf7ac7dde5f6b9d50b160cd0a4091e60ac699f80ecec7ea084e925de5b71eec65410afb56f78747351b048c115a8b9cd62fdbf9d8a25e1038aafd737b8
7
+ data.tar.gz: b27356aac6130b6e2e3ee78f6bc61b225ca083b7e128dd820c15f09bd1c55c0363a031bdc7e6d92a6134e26a556205a453a2c92af8620e12c0937c5eef68f2d3
data/bin/rtfm CHANGED
@@ -46,6 +46,7 @@ JUMPING AND MARKS
46
46
  Press '-' and a letter to delete that mark
47
47
  M = Show marked items in right pane
48
48
  ' = Jump to mark (next letter is the name of the mark [a-zA-Z'])
49
+ The 5 latest directories visited are stored in marks 1-5 (1 being the very latest)
49
50
  / = Enter search string in bottom window to highlight matching items and jump to the first match
50
51
  n = Jump to the next item matched by '/'
51
52
  N = Jump to the previous item matched by '/'
@@ -134,6 +135,7 @@ begin # BASIC SETUP
134
135
  def cmd?(command)
135
136
  system("which #{command} > /dev/null 2>&1")
136
137
  end
138
+
137
139
  if cmd?('/usr/lib/w3m/w3mimgdisplay')
138
140
  @w3mimgdisplay = "/usr/lib/w3m/w3mimgdisplay"
139
141
  @showimage = true
@@ -141,6 +143,8 @@ begin # BASIC SETUP
141
143
  @showimage = false
142
144
  end
143
145
  @showimage = false unless (cmd?('xwininfo') and cmd?('xdotool'))
146
+
147
+ cmd?('bat') ? @bat = "bat" : @bat = "batcat"
144
148
 
145
149
  STDIN.set_encoding(Encoding::UTF_8) # Set encoding for STDIN
146
150
  LScolors = `echo $LS_COLORS` # Import LS_COLORS
@@ -261,6 +265,13 @@ def getchr # PROCESS KEY PRESSES
261
265
  when '7' then chr = "HOME" ; STDIN.getc
262
266
  when '8' then chr = "END" ; STDIN.getc
263
267
  end
268
+ when 'O' # Set Ctrl+ArrowKey equal to ArrowKey; May be used for other purposes in the future
269
+ case $stdin.getc
270
+ when 'a' then chr = "UP"
271
+ when 'b' then chr = "DOWN"
272
+ when 'c' then chr = "RIGHT"
273
+ when 'd' then chr = "LEFT"
274
+ end
264
275
  end
265
276
  when "", "" then chr = "BACK"
266
277
  when "" then chr = "WBACK"
@@ -315,7 +326,7 @@ def main_getkey # GET KEY FROM USER
315
326
  var_resets
316
327
  cur_dir = Dir.pwd
317
328
  @directory[Dir.pwd] = @selected # Store this directory before leaving
318
- @marks["'"] = Dir.pwd
329
+ mark_latest
319
330
  Dir.chdir("..")
320
331
  @directory[Dir.pwd] = File.basename(cur_dir) unless @directory.key?(Dir.pwd)
321
332
  @w_r.update = true
@@ -323,14 +334,14 @@ def main_getkey # GET KEY FROM USER
323
334
  when 'RIGHT', 'l'
324
335
  var_resets
325
336
  @directory[Dir.pwd] = @selected # Store this directory before leaving
326
- @marks["'"] = Dir.pwd
337
+ mark_latest
327
338
  open_selected()
328
339
  @w_r.update = true
329
340
  @w_b.update = true
330
341
  when 'x' # Force open with file opener (used to open HTML files in browser)
331
342
  var_resets
332
343
  @directory[Dir.pwd] = @selected # Store this directory before leaving
333
- @marks["'"] = Dir.pwd
344
+ mark_latest
334
345
  open_selected(true)
335
346
  @w_r.update = true
336
347
  @w_b.update = true
@@ -370,8 +381,6 @@ def main_getkey # GET KEY FROM USER
370
381
  @w_r.update = false
371
382
  @w_b.update = true
372
383
  when 'M' # Show marks
373
- @marks = @marks.sort.to_h
374
- @w_r.fg = 147
375
384
  marks_info
376
385
  @w_r.update = false
377
386
  @w_b.update = true
@@ -387,6 +396,7 @@ def main_getkey # GET KEY FROM USER
387
396
  rescue
388
397
  w_b_info(" No such directory")
389
398
  end
399
+ mark_latest
390
400
  @marks["'"] = dir_before
391
401
  end
392
402
  @w_r.update = true
@@ -394,13 +404,13 @@ def main_getkey # GET KEY FROM USER
394
404
  when '~' # Go to home dir
395
405
  var_resets
396
406
  @directory[Dir.pwd] = @selected # Store this directory before leaving
397
- @marks["'"] = Dir.pwd
407
+ mark_latest
398
408
  Dir.chdir
399
409
  @w_r.update = true
400
410
  @w_b.update = true
401
411
  when 'f' # Follow symlink
402
412
  @directory[Dir.pwd] = @selected # Store this directory before leaving
403
- @marks["'"] = Dir.pwd
413
+ mark_latest
404
414
  if File.symlink?(@selected)
405
415
  begin
406
416
  Dir.chdir(File.dirname(File.readlink(@selected)))
@@ -426,7 +436,7 @@ def main_getkey # GET KEY FROM USER
426
436
  jumpdir = File.dirname(jumpdir)
427
437
  end
428
438
  @directory[Dir.pwd] = @selected # Store this directory before leaving
429
- @marks["'"] = Dir.pwd
439
+ mark_latest
430
440
  Dir.chdir(jumpdir)
431
441
  @w_r.pager = 0
432
442
  end
@@ -594,8 +604,8 @@ def main_getkey # GET KEY FROM USER
594
604
  text += [[195, 0, ps]]
595
605
  disk = `df -H | head -8`
596
606
  text += [[172, 0, disk]]
597
- dmesg = "\nDMESG:\n"
598
- dmesg += `dmesg | tail -6`
607
+ dmesg = "\nDMESG (latest first):\n"
608
+ dmesg += `dmesg | tail -6`.split("\n").sort.reverse.join("\n")
599
609
  text += [[219, 0, dmesg]]
600
610
  w_r_info(ansifix(text))
601
611
  rescue
@@ -603,7 +613,7 @@ def main_getkey # GET KEY FROM USER
603
613
  end
604
614
  # RIGHT PANE
605
615
  when 'ENTER' # Refresh right pane
606
- @w_r.clr # First clear the window, then clear any previously showing image
616
+ @w_r.fill # First clear the window, then clear any previously showing image
607
617
  image_show("clear") if @image; @image = false
608
618
  @w_r.update = true
609
619
  @w_b.update = true
@@ -766,6 +776,14 @@ def ansifix(text) # Format [[fg, attr, text]]
766
776
  end
767
777
  return output
768
778
  end
779
+ def mark_latest
780
+ @marks["5"] = @marks["4"]
781
+ @marks["4"] = @marks["3"]
782
+ @marks["3"] = @marks["2"]
783
+ @marks["2"] = @marks["1"]
784
+ @marks["1"] = @marks["'"]
785
+ @marks["'"] = Dir.pwd
786
+ end
769
787
  # TOP WINDOW FUNCTIONS
770
788
  def w_t_info # SHOW INFO IN @w_t
771
789
  text = " " + ENV['USER'].to_s + "@" + `hostname 2>/dev/null`.to_s.chop + ": " + Dir.pwd + "/"
@@ -887,7 +905,7 @@ end
887
905
  def open_selected(html = nil) # OPEN SELECTED ITEM (when pressing RIGHT)
888
906
  if File.directory?(@selected) # Rescue for permission error
889
907
  begin
890
- @marks["'"] = Dir.pwd
908
+ mark_latest
891
909
  Dir.chdir(@selected)
892
910
  rescue
893
911
  end
@@ -953,8 +971,8 @@ def w_r_show # SHOW CONTENTS IN THE RIGHT WINDOW
953
971
  # TEXT
954
972
  elsif File.read(@selected).force_encoding("UTF-8").valid_encoding? and @w_r.pager == 0
955
973
  begin # View the file as text if it is utf-8
956
- @w_r.pager_cmd = "batcat -n --color=always #{@selected_safe} 2>/dev/null"
957
- @w_r.text = `batcat -n --color=always --line-range :#{@w_r.maxy} #{@selected_safe} 2>/dev/null`
974
+ @w_r.pager_cmd = "#{@bat} -n --color=always #{@selected_safe} 2>/dev/null"
975
+ @w_r.text = `#{@bat} -n --color=always --line-range :#{@w_r.maxy} #{@selected_safe} 2>/dev/null`
958
976
  pager_start
959
977
  syntax_highlight(@w_r.text)
960
978
  rescue
@@ -1036,6 +1054,8 @@ def w_r_info(info) # SHOW INFO IN THE RIGHT WINDOW
1036
1054
  @w_r.update = false
1037
1055
  end
1038
1056
  def marks_info # SHOW MARKS IN RIGHT WINDOW
1057
+ @w_r.fg = 183
1058
+ @marks = @marks.sort.to_h
1039
1059
  info = "MARKS:\n"
1040
1060
  unless @marks.empty?
1041
1061
  @marks.each do |mark, dir|
@@ -1295,7 +1315,7 @@ def w_b_exec(cmd) # EXECUTE COMMAND FROM @W_B
1295
1315
  status = Timeout::timeout(5) {
1296
1316
  @w_r.clr
1297
1317
  begin
1298
- @w_r.pager_cmd = "#{cmd} | batcat -n --color=always 2>/dev/null"
1318
+ @w_r.pager_cmd = "#{cmd} | #{bat} -n --color=always 2>/dev/null"
1299
1319
  @w_r.text = `#{@w_r.pager_cmd} 2>/dev/null`
1300
1320
  rescue
1301
1321
  @w_r.text = `#{cmd} 2>/dev/null`
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: 1.7.4
4
+ version: 1.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-11 00:00:00.000000000 Z
11
+ date: 2021-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses
@@ -33,7 +33,8 @@ dependencies:
33
33
  description: 'A full featured terminal browser with syntax highlighted files, images
34
34
  shown in the terminal, videos thumbnailed, etc. You can bookmark and jump around
35
35
  easily, delete, rename, copy, symlink and move files. RTFM has a a wide range of
36
- other features. New in 1.7.4: Fixed bug on jumping to mark and then pressing PgUp'
36
+ other features. New in 1.8.3: Fixed bug on Ctrl+ArrowKey, added bat as possible
37
+ command for batcat'
37
38
  email: g@isene.com
38
39
  executables:
39
40
  - rtfm