rtfm-filemanager 2.6.5 → 2.7

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 +3 -1
  3. data/bin/rtfm +46 -16
  4. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a19c4cda253d8784a5a1a5235f0e0ef2066a5122bdd8838a2379e00636f6465
4
- data.tar.gz: cb4cb08b5a5e6f011b66ad584a495b57268543f040b3671f4e311f44f1c680d8
3
+ metadata.gz: 2aa222a4668d6751af768b71fb4041d9a8f2c07b9546c2c6a85a3599fd99f9b5
4
+ data.tar.gz: bac0932190b194982ea98da8f20919b101a2e0be293a8bbc1e8ec77fbc67bb5d
5
5
  SHA512:
6
- metadata.gz: 699b7d44e63db93c9feafada2d5aff735c8e532e64e856e756bac9cb2aa115c5c6f2c158f7d380ffeaa7fc1ca71d159b1f97a592b5f62355b7e4b20fd8dc504a
7
- data.tar.gz: 0d8ff8a42ee9e11ce0fd318fdf42eba684eef9cd4ef9afb9e0c39cff07919caaf0983a159890acff2574dc4daf359005a8d17d47945885257cdc253aeefd53d2
6
+ metadata.gz: '0048f6b34b0cadef7d539330ea23f45b782e2718b843b46f648c4d3f00dc67fd73561b2a55fd494b9a5af50e873afb0b8f9234bb4b663be325b812208736d137'
7
+ data.tar.gz: e8c03a48d9b6b17bd248b377ce7f82f2d783989fa412e3aacdf803c1561e347855c3a4072a75ea63f966ba43be30efb952b51ef966e533a65193953718d1944c
data/README.md CHANGED
@@ -232,8 +232,9 @@ S-TAB | Previous page (if you have moved down the document first - ∆ in the t
232
232
  w | Change the width of the left/right panes (left pane ⇒ ⅓ ⇒ ¼ ⇒ ⅕ ⇒ ⅙ ⇒ ½ ⇒ ⅓)
233
233
  \- | Toggle preview in right pane (turn it off for faster traversing of directories)
234
234
  _ | Toggle preview of images in right pane
235
+ b | Toggle syntax highlighting (and line numbering)
235
236
 
236
- ### Additinal commands
237
+ ### Additional commands
237
238
 
238
239
  Key | Description
239
240
  -------|------------------------------------------------------------------
@@ -245,6 +246,7 @@ B | Toggle border
245
246
  ; | Show command history in right pane
246
247
  y | Copy path of selected item to primary selection (for pasting with middle mouse button)
247
248
  Y | Copy path of selected item to clipboard
249
+ C-Y | Copy content of right pane to clipboard
248
250
  S | Show comprehensive system info (system, CPU, filesystem, latest dmesg messages)
249
251
  Ctrl-n | Invoke navi (see https://github.com/denisidoro/navi) with any output in right window
250
252
 
data/bin/rtfm CHANGED
@@ -56,7 +56,6 @@ JUMPING AND MARKS
56
56
  L = Start 'locate' search for files, then use '#' to jump to desired line/directory
57
57
  Ctrl-l = Locate files via fzf from the current directory down
58
58
  (fuzzy file finder must be installed https://github.com/junegunn/fzf)
59
- Ctrl-n = Invoke navi (see https://github.com/denisidoro/navi) with any output in right window
60
59
 
61
60
  TAGGING
62
61
  t = Tag item (toggles)
@@ -93,8 +92,9 @@ RIGHT PANE
93
92
  w = Change the width of the left/right panes (left pane ⇒ ⅓ ⇒ ¼ ⇒ ⅕ ⇒ ⅙ ⇒ ½ ⇒ ⅓)
94
93
  - = (Minus sign) Toggle preview in right pane (turn it off for faster traversing of directories)
95
94
  _ = (Underscore) Toggle preview of images in right pane
95
+ b = Toggle syntax highlighting (and line numbering)
96
96
 
97
- ADDITINAL COMMANDS
97
+ ADDITIONAL COMMANDS
98
98
  f = Show only files in the left pane matching extension(s) (e.g. "txt" or "pdf,png,jpg")
99
99
  F = Show only files matching a pattern (Ruby Regex) (e.g. "abc" or "ab.+12(\w3)*")
100
100
  g = Run 'grep' to show files that contains the MATCH in current directory
@@ -103,7 +103,9 @@ ADDITINAL COMMANDS
103
103
  ; = Show command history in right pane
104
104
  y = Copy path of selected item to primary selection (for pasting with middle mouse button)
105
105
  Y = Copy path of selected item to clipboard
106
+ C-Y = Copy content of right pane to clipboard
106
107
  S = Show comprehensive System info (system, CPU, filesystem, latest dmesg messages)
108
+ Ctrl-n = Invoke navi (see https://github.com/denisidoro/navi) with any output in right window
107
109
 
108
110
  COPYRIGHT: Geir Isene, 2020-3. No rights reserved. See http://isene.com for more.
109
111
  HELPTEXT
@@ -154,6 +156,7 @@ begin # BASIC SETUP
154
156
  @showimage = false unless (cmd?('xwininfo') and cmd?('xdotool'))
155
157
 
156
158
  cmd?('bat') ? @bat = "bat" : @bat = "batcat"
159
+ @batuse = true
157
160
 
158
161
  STDIN.set_encoding(Encoding::UTF_8) # Set encoding for STDIN
159
162
  LScolors = `echo $LS_COLORS` # Import LS_COLORS
@@ -189,6 +192,7 @@ begin # BASIC SETUP
189
192
  @lsfiles = "" # File types to show (initially set to all file types) - not saved on exit
190
193
  @lsmatch = "" # Files to match (initially set to matching all files) - not saved on exit
191
194
  @index = 0 # Set chosen item to first on startup
195
+ @cont = ""
192
196
  @navi = ""
193
197
  @marks["'"] = Dir.pwd
194
198
  ## File type recognizers
@@ -309,6 +313,7 @@ def getchr # PROCESS KEY PRESSES
309
313
  when " " then chr = "C-L"
310
314
  when "" then chr = "C-N"
311
315
  when "" then chr = "C-T"
316
+ when "" then chr = "C-Y"
312
317
  when "\r" then chr = "ENTER"
313
318
  when "\t" then chr = "TAB"
314
319
  when /./ then chr = c
@@ -543,14 +548,14 @@ def main_getkey # GET KEY FROM USER
543
548
  w_b_info(err.to_s)
544
549
  end
545
550
  @w_r.update = true
546
- when 'z'
551
+ when 'z' # Unzip selected archive file
547
552
  cmd = w_b_getstr("Command = ", "tar xfz #{@tagged.first}")
548
553
  begin
549
554
  w_b_exec(cmd + " 2>/dev/null")
550
555
  rescue StandardError => err
551
556
  w_b_info(err.to_s)
552
557
  end
553
- when 'Z'
558
+ when 'Z' # Create archive file
554
559
  arc = w_b_getstr("Archive name: ", "")
555
560
  cmd = w_b_getstr("Command = ", "tar cfz #{arc}.gz #{@tagged.join(" ")}")
556
561
  begin
@@ -669,7 +674,7 @@ def main_getkey # GET KEY FROM USER
669
674
  rescue
670
675
  w_r_info("Unable to show system info")
671
676
  end
672
- when 'I'
677
+ when 'I' # OpenAI integration
673
678
  if @ai
674
679
  openai
675
680
  else
@@ -701,21 +706,24 @@ def main_getkey # GET KEY FROM USER
701
706
  @width = 2 if @width == 7
702
707
  @break = true
703
708
  @w_b.update = true
704
- when 'B'
709
+ when 'B' # Toggle borders
705
710
  @border = !@border
706
711
  @break = true
707
- when '-'
712
+ when '-' # Toggle content view in right pane
708
713
  @preview = !@preview
709
714
  @preview ? p = "On" : p = "Off"
710
715
  w_b_info("Preview = " + p)
711
716
  getch
712
717
  @break = true
713
- when '_'
718
+ when '_' # Toggle image view
714
719
  @showimage = !@showimage
715
720
  @showimage ? i = "On" : i = "Off"
716
721
  w_b_info("Image preview = " + i)
717
722
  getch
718
723
  @break = true
724
+ when 'b'
725
+ @batuse = !@batuse
726
+ @break = true
719
727
  # ADDITIONAL COMMANDS
720
728
  when 'f' # Filter out filetypes not matching @lsfiles
721
729
  loop do
@@ -726,7 +734,7 @@ def main_getkey # GET KEY FROM USER
726
734
  when 'F' # Filter out files not matching @lsmatch
727
735
  @lsmatch = w_b_getstr("Files will match RegEx: ", @lsmatch)
728
736
  w_b_info(nil)
729
- when 'C-L'
737
+ when 'C-L' # fzf integration (https://github.com/junegunn/fzf)
730
738
  begin
731
739
  jump = `fzf`.chomp
732
740
  rescue
@@ -738,7 +746,7 @@ def main_getkey # GET KEY FROM USER
738
746
  mark_latest
739
747
  Dir.chdir(jumpdir)
740
748
  @break = true
741
- when 'C-N'
749
+ when 'C-N' # navi integration (https://github.com/denisidoro/navi)
742
750
  begin
743
751
  @navi = `navi`
744
752
  rescue
@@ -796,6 +804,19 @@ def main_getkey # GET KEY FROM USER
796
804
  end
797
805
  system("echo -n '#{path}' | #{clip}")
798
806
  end
807
+ when 'C-Y' # Copy right pane to clipboard
808
+ clip = "xclip -selection clipboard"
809
+ @cont.gsub!(/ ¤¤\d+¤¤\d*¤¤/, '')
810
+ @cont.gsub!(/^¤¤\d+¤¤\d*¤¤ */, '')
811
+ @cont.gsub!(/¤¤\d+¤¤\d*¤¤/, '')
812
+ @cont.gsub!(/ /, '')
813
+ @cont.gsub!(/ (\d)/, '\1')
814
+ @cont.gsub!(/\[(\d+;)+\d+m/, '')
815
+ @cont = @cont.inspect
816
+ @cont.gsub!('\"', '"')
817
+ @cont = @cont [1...-1]
818
+ w_b_info(" Right pane copied to clipboard")
819
+ system("echo -n '#{@cont}' | #{clip}")
799
820
  when '@' # Enter "Ruby debug"
800
821
  @w_b.nohistory = true
801
822
  cmd = w_b_getstr("◆ ", "")
@@ -941,6 +962,7 @@ def list_dir(active) # LIST CONTENT OF A DIRECTORY (BOTH active AND RIGHT WINDOW
941
962
  ix = @index - @w_l.maxy/2 if @index > @w_l.maxy/2 and @files.size > @w_l.maxy - 1
942
963
  else
943
964
  win = @w_r
965
+ @cont = ""
944
966
  end
945
967
  while ix < @files.size and t < win.maxy do
946
968
  str = @files[ix]
@@ -999,6 +1021,7 @@ def list_dir(active) # LIST CONTENT OF A DIRECTORY (BOTH active AND RIGHT WINDOW
999
1021
  return
1000
1022
  end
1001
1023
  str += link + dir
1024
+ @cont += str + "\n" unless active # Adds to content in right win for copying
1002
1025
  win.attron(file_marker) { win << str } # Implement color/bold to the item
1003
1026
  win.clrtoeol
1004
1027
  win << "\n"
@@ -1082,12 +1105,17 @@ def w_r_show # SHOW CONTENTS IN THE RIGHT WINDOW
1082
1105
  list_dir(false)
1083
1106
  # TEXT
1084
1107
  elsif File.read(@selected).force_encoding("UTF-8").valid_encoding? and @w_r.pager == 0
1085
- begin # View the file as text if it is utf-8
1086
- @w_r.pager_cmd = "#{@bat} -n --color=always #{@selected_safe} 2>/dev/null"
1087
- @w_r.text = `#{@bat} -n --color=always --line-range :#{@w_r.maxy} #{@selected_safe} 2>/dev/null`
1088
- pager_start
1089
- syntax_highlight(@w_r.text)
1090
- rescue
1108
+ if @batuse
1109
+ begin # View the file as text if it is utf-8
1110
+ @w_r.pager_cmd = "#{@bat} -n --color=always #{@selected_safe} 2>/dev/null"
1111
+ @w_r.text = `#{@bat} -n --color=always --line-range :#{@w_r.maxy} #{@selected_safe} 2>/dev/null`
1112
+ pager_start
1113
+ syntax_highlight(@w_r.text)
1114
+ rescue
1115
+ @w_r.pager_cmd = "cat #{@selected_safe} 2>/dev/null"
1116
+ w_r_doc
1117
+ end
1118
+ else
1091
1119
  @w_r.pager_cmd = "cat #{@selected_safe} 2>/dev/null"
1092
1120
  w_r_doc
1093
1121
  end
@@ -1223,6 +1251,7 @@ def pager_start # START PAGING
1223
1251
  if @w_r.text.lines.count > @w_r.maxy - 2
1224
1252
  @w_r.pager_more = true
1225
1253
  end
1254
+ @cont = @w_r.text # For copying right win
1226
1255
  end
1227
1256
  def pager_show # SHOW THE CURRENT PAGE CONTENT
1228
1257
  @w_r.setpos(0,0)
@@ -1242,6 +1271,7 @@ def pager_show # SHOW THE CURRENT PAGE CONTENT
1242
1271
  @w_r.attr = 0 if @w_r.attr == nil
1243
1272
  @w_r.attron(color_pair(@w_r.fg) | @w_r.attr) { @w_r << input }
1244
1273
  end
1274
+ @cont = input # For copying right win
1245
1275
  (@w_r.maxy - @w_r.cury).times {@w_r.deleteln()} # Clear to bottom of window
1246
1276
  pager_add_markers
1247
1277
  @w_r.refresh
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: 2.6.5
4
+ version: '2.7'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-24 00:00:00.000000000 Z
11
+ date: 2023-04-25 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 2.6.5: Fixed border issue when writing conf (W)'
50
+ other features. New in 2.7: Added copying of right pane (C-Y) and toggle highlighting
51
+ (b)'
51
52
  email: g@isene.com
52
53
  executables:
53
54
  - rtfm