about summary refs log tree commit diff stats
path: root/code
diff options
context:
space:
mode:
Diffstat (limited to 'code')
-rw-r--r--code/draw.rb55
-rw-r--r--code/help.rb229
2 files changed, 250 insertions, 34 deletions
diff --git a/code/draw.rb b/code/draw.rb
index 45c654a8..5a6380e7 100644
--- a/code/draw.rb
+++ b/code/draw.rb
@@ -179,42 +179,29 @@ module Fm
 
 		if @buffer =~ /^block/
 			screensaver
-		elsif @buffer == '?'
+		elsif @buffer =~ /^\?/
 			cleari
-			puti 0, "      - - - Help - - -"
-			puti 2, "   h/j/k/l: Movement    J/K: fast Movement"
-			puti 3, "   H: Descend directory with respect to symlinks"
-			puti 4, "   L: Wait for <Enter> after execution of a program"
-			puti 6, "   t: Toggle Option     S: Change Sorting"
-			puti 7, "   E: Edit file         s: Enter Shell"
-			puti 8, "   rmdir: Remove whole dir  dD: Delete file or empty dir"
-			puti 9, "   dd: Move file to ~/.trash and memorize it's new path"
-			puti 10,"   yy: Memorize path    p: Copy memorized file here"
-			puti 11,"   mv<place>: move file to place  mkdir<name>: obvious"
-			puti 12,"   mX: Bookmark dir     'X: Enter bookmarked dir"
-			puti 13,"   '': Enter last visited dir (note: ' and ` are equal)"
-			puti 13,"   !<command> executes command"
-			puti 15,"   To interrupt current operations: <Ctrl-C>"
-			puti 16,"   To quit: q / ZZ / <Ctrl-D> / <Ctrl-C><Ctrl-C> (twice in a row)"
-			puti 18,"   Press one of those keys for more information: g f"
-		elsif @buffer == '?f'
-			cleari
-			puti 0, "      - - - Help - - -"
-			puti 2, "   f<regexp> or /<regexp> searches for pattern and presses l"
-			puti 3, "       when a matching file is found."
-			puti 4, "       Pressing L in this mode is like pressing l outside"
-			puti 6, "   F<regexp> like f but stay in this mode until <esc> is pressed"
-		elsif @buffer == '?g'
+			puti 0, "   - - - Help - - -"
+			if text = HELP[@buffer[1..-1]]
+				i = 2
+				text.each_line do |l|
+					break if i == lines
+					puti(i, l)
+					i += 1
+				end
+			end
+		elsif @buffer =~ /^o|`|'$/
 			cleari
-			puti 0, "      - - - Help - - -"
-			puti 2, "   gg: go to top"
-			puti 3, "   G:  go to bottom"
-			puti 4, "   g0: go to /"
-			puti 5, "   gu: go to /usr/"
-			puti 6, "   gm: go to /media/"
-			puti 7, "   ge: go to /etc/"
-			puti 8, "   gh: go to ~/"
-			puti 9, "   gt: go to ~/.trash/"
+			i = 0
+			case @buffer
+			when 'o'; puti 0, "   move files to:"
+			when '`', "'"; puti 0, "   go to:"
+			end
+			for key,val in @memory
+				next if key == "'"
+				break if key == lines
+				puti i+=1, 2, "#{key} => #{val}"
+			end
 		else
 			@pwd.recheck_stuff()
 			cf = currentfile
diff --git a/code/help.rb b/code/help.rb
new file mode 100644
index 00000000..77d93e1d
--- /dev/null
+++ b/code/help.rb
@@ -0,0 +1,229 @@
+module Fm
+	def self.get_help()
+		helptext = <<END
+
+
+
+
+	key:
+	Press a key to view the topic:
+		?     quick summary
+		m     basic movement and control
+		g     quickly switching directories
+		f     filtering and searching
+		l     running files in different ways
+		c     creating, deleting, moving, copying
+		o     more commands that don't fit elsewhere
+
+   To interrupt current operations: <Ctrl-C>
+   To quit: Q or ZZ or <Ctrl-D> or <Ctrl-C><Ctrl-C> (quickly twice in a row)
+
+
+	And always take care of which keys you press. This tool not only
+	makes it easy to access files but also to destroy them.
+
+
+
+
+
+	key:?
+	Movement:                h,j,k,l or arrow-keys
+	Run file or enter dir:   l or RIGHT or ENTER
+	Move 1 directory back:   h or LEFT or BACKSPACE
+
+	R:      Refresh the view     <Ctrl-R>:    Reload everything
+	Space:  Mark a file.  v:  Reverse markings.  V:  Clear markings
+	Bookmark directories with mX and re-enter them with 'X
+
+	To search, type / or f followed by the text
+	If you use f, the first non-ambiguous match will be entered/run
+
+	mkdir<name> or touch<name> to create dirs or files
+
+	move file to ~/.trash:     dd
+	delete file forever:       dfd
+	delete whole dir forever:  delete
+
+	copy file:     cp or yy
+	cut file:      cut
+	paste file:    p
+	move/rename:   mv<name> or cw<name>
+
+
+
+
+
+
+	key:m
+	R           refresh the view
+	<Ctrl-R>    completely reloads the file memory
+
+	k or UP     move 1 item up
+	j or DOWN   move 1 item down
+	K           move half the screen up
+	J           move half the screen down
+	PAGE UP     move the whole screen up
+	PAGE DOWN   move the whole screen down
+	HOME or gg  move to the top
+	END or G    move to the bottom
+
+	h or LEFT or BACKSPACE  move one directory back
+	l or RIGHT or ENTER     enter the directory or run the file.
+	H                       like h, but if if pwd is on a symlink,
+                           you get to the original location
+
+
+
+
+
+	key:g
+	m<key>   bookmark this directory
+	um<key>  un-marks the specified bookmark
+	'        shows an overview of all bookmarks
+	'<key>   re-enter bookmarked directory.
+	TAB      equivalent to ''
+
+	the quote ', backquote ` and the command "go" do the same
+
+   g0    go to /
+   gu    go to /usr/
+   gm    go to /media/
+   gn    go to /mnt/
+   ge    go to /etc/
+   gs    go to /srv/
+   gh    go to ~/
+   gt    go to ~/.trash/
+
+	all of this commands, and also quitting the program, will save
+	the old directory at ` so you can re-enter it by typing `` or '' or TAB
+
+
+
+
+
+
+	key:f
+	/<expr>    Search for a "regular expression"
+	f<expr>    Like / but enters/runs the first non-ambiguous match
+	F<expr>    Shows only files which match the regular expression.
+	n or N     goes to the next or previous match.
+	           if you search for nothing, n goes to the newest file.
+
+	What is a regular expression:
+	A very flexible way of defining patterns in text. By writing
+	Special characters, you can specify what to search:
+		.       matches any character
+		\\d      matches any digit
+		\\w      matches any letter (ascii)
+		\\s      matches any whitespace
+		|       either the preceding or next expression may match
+		{m,n}   at least m and at most n repetitions of the preceding
+		*       zero or more repetitions of the preceding
+		+       one or more repetitions of the preceding
+		?       at most one repetition of the preceding
+		^ or $  the beginning or the end of the string
+
+	More at: http://www.ruby-doc.org/docs/UsersGuide/rg/regexp.html
+
+	If you're just searching or a simple string, it's usually enough to write
+	it down. To escape the special characters, precede them with a \\
+
+
+
+
+
+
+
+	key:l
+	Space:  Mark a file.  v:  Reverse markings   V:  Clear markings
+
+	l or RIGHT   Enter the directory or run the file in mode 0, flag "a"
+   L            Run in a different way: mode 1, no flags
+	r<n><f>r     Run with mode <n> and flags <f>. example: r3adr
+	             Default mode: 0, default flags: no flags at all
+
+	What are flags:
+	Letters that specify details on how ranger should run the program.
+	Capital letters reverse the function. use as many flags as you want.
+
+		a        Run the selection rather than just the highlighted file
+		t        Run in a detached terminal (implies d)
+		d or e   Run as a detached process inside the current terminal
+		w        Wait for a <enter> after execution of the programm
+
+	What are modes:
+	A number from 0 to infinity that specifies what shell command should
+	be executed, since most file types have different ways to be run.
+
+	You can set up the commands for each type in the file  ranger/data/apps.rb
+
+
+
+
+
+
+	
+	key:c
+	the word "selection" means
+	if you marked something: all marked items and NOT the highlighted item
+	otherwise: the selected item.
+	
+	mkdir<name>   creates directory
+	touch<name>   creates file
+
+   yy or cp    Memorize selection
+	cut         like cp, but move instead of copy if "p" is pressed
+	p           Copy memorized files here.
+	o<key>      Copy selection to the bookmarked dir (see ?g)
+
+	use deleteing commands with caution!
+   dd:          Move selection to ~/.trash and memorize it's new path
+	             (so it can be pasted with p)
+	dfd:         Deletes the selection or empty directory
+	delete:      Remove whole selection with all contents
+
+   mv<name>:    move/rename file to <name>
+	cw<name>:    same as mv
+	A:           write "cw <name of current file>" to the key buffer
+
+
+
+
+
+
+
+	key:o
+	t            Toggle Option
+	S            Change Sorting
+	E            Edit file
+	s            Enter Shell
+   !<command>   Executes command
+   !!<command>  Executes command and waits for enter-press afterwards
+	term         Runs a detached terminal in the current directory
+	block        Blocks the program, until you write: stop
+	- or =       decreases or increases audio volume (alsa)
+
+
+
+
+
+
+
+
+
+END
+		hash = {}
+		current = nil
+		helptext.gsub("\t", "   ").each_line do |l|
+			if l =~ /^\s*key:(.*)$/
+				current = hash[$1] = ""
+			elsif current
+				current << l
+			end
+		end
+		return hash
+	end
+
+	HELP = get_help
+end
+
trace.cc.html?h=hlt&id=d3a9db3aff54ea485f409eaaef3d8f56ad77f0dc'>d3a9db3a ^
6e1eeeeb ^




fd7d8138 ^
6e1eeeeb ^
















d3a9db3a ^
6e1eeeeb ^











d3a9db3a ^
6e1eeeeb ^

d3a9db3a ^

6e1eeeeb ^



















d3a9db3a ^
6e1eeeeb ^








c504ca56 ^
6e1eeeeb ^




d3a9db3a ^
6e1eeeeb ^















d3a9db3a ^
6e1eeeeb ^







d3a9db3a ^
6e1eeeeb ^









c504ca56 ^
d3a9db3a ^
6e1eeeeb ^
d3a9db3a ^
6e1eeeeb ^

d3a9db3a ^










6e1eeeeb ^
d3a9db3a ^


















6e1eeeeb ^
d3a9db3a ^



































































6e1eeeeb ^
d3a9db3a ^









































































































































6e1eeeeb ^
d3a9db3a ^



























c504ca56 ^




d3a9db3a ^
c504ca56 ^

















d3a9db3a ^
c504ca56 ^
d3a9db3a ^

c504ca56 ^

d3a9db3a ^
c504ca56 ^































672e3e50 ^


a654e4ec ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588