about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--code/directory.rb10
-rw-r--r--code/draw.rb14
-rw-r--r--code/fm.rb11
-rw-r--r--code/keys.rb31
-rw-r--r--ranger.conf9
-rwxr-xr-xranger.rb19
6 files changed, 53 insertions, 41 deletions
diff --git a/code/directory.rb b/code/directory.rb
index 01634ca0..c738b995 100644
--- a/code/directory.rb
+++ b/code/directory.rb
@@ -27,7 +27,7 @@ class Directory
 		@mtime = File.mtime(@path)
 		log @path
 		@files = Dir.new(@path).to_a rescue []
-		if OPTIONS['hidden']
+		if Option.show_hidden
 			@files -= ['.', '..', 'lost+found']
 		else
 			@files.reject!{|x| x[0] == ?. or x == 'lost+found'}
@@ -160,7 +160,7 @@ class Directory
 
 #	def refresh()
 #		@files = Dir.new(@path).to_a
-#		if OPTIONS['hidden']
+#		if Option.hidden
 #			@files -= ['.', '..', 'lost+found']
 #		else
 #			@files.reject!{|x| x[0] == ?. or x == 'lost+found'}
@@ -203,7 +203,7 @@ class Directory
 	end
 
 	def sort_sub(x, y)
-		case OPTIONS['sort']
+		case Option.sort
 		when :name
 			x.basename <=> y.basename
 		when :ext
@@ -223,7 +223,7 @@ class Directory
 
 	def sort()
 		@files = @files.sort {|x,y|
-			if OPTIONS['dir_first']
+			if Option.dir_first
 				if x.dir?
 					if y.dir? then sort_sub(x, y) else -1 end
 				else
@@ -233,7 +233,7 @@ class Directory
 				sort_sub(x, y)
 			end
 		}
-		@files.reverse! if OPTIONS['sort_reverse']
+		@files.reverse! if Option.sort_reverse
 		@files_raw = @files.map{|x| x.to_s}
 	end
 end
diff --git a/code/draw.rb b/code/draw.rb
index 75f54a88..aaca6253 100644
--- a/code/draw.rb
+++ b/code/draw.rb
@@ -5,7 +5,7 @@ module Fm
 
 	def column_put_file(n, file)
 		i = 0
-		if OPTIONS['preview'] and OPTIONS['filepreview'] and file.path !~ DONT_PREVIEW_THESE_FILES
+		if Option.preview and Option.file_preview and file.path !~ DONT_PREVIEW_THESE_FILES
 			m = lines - 2
 			attr_set(Color.base)
 			left, wid = get_boundaries(n)
@@ -122,7 +122,7 @@ module Fm
 				puti l, left, fn[0, wid-1].ljust(wid+1)
 			end
 
-			if infos and OPTIONS['wide_bar']
+			if infos and Option.wide_bar
 				attr_at(l, left-1, wid+1, mycolor.send(clrname))
 			else
 				attr_at(l, left, fn.size.limit(wid-1), mycolor.send(clrname))
@@ -161,7 +161,7 @@ module Fm
 			
 		when 1
 			q = cols / 8
-			if !OPTIONS['preview']# or (!OPTIONS['filepreview'] and !currentfile.dir?)
+			if !Option.preview# or (!Option.filepreview and !currentfile.dir?)
 				return q, 2*q
 #			elsif currentfile.path != DONT_PREVIEW_THESE_FILES
 #				return q, 2*q
@@ -170,10 +170,10 @@ module Fm
 			end
 
 		when 2
-			if !OPTIONS['preview']
+			if !Option.preview
 				q = cols * 0.375 - 1
 				w = @path.last.width.limit(cols * 0.625, cols/8)
-#			elsif currentfile.path =~ DONT_PREVIEW_THESE_FILES or (!OPTIONS['filepreview'] and !currentfile.dir?)
+#			elsif currentfile.path =~ DONT_PREVIEW_THESE_FILES or (!Option.filepreview and !currentfile.dir?)
 #				q = cols / 4
 #				w = @path.last.width.limit(cols * 0.75, cols/8)
 			else
@@ -250,7 +250,7 @@ module Fm
 #			bold false
 
 			begin
-				if OPTIONS['preview']
+				if Option.preview
 					if cf.dir?
 						put_directory(3, @dirs[cf.path])
 					elsif cf.file?
@@ -284,7 +284,7 @@ module Fm
 			when 'S'
 				puti btm, "Sort by (n)ame (s)ize (m)time (c)time (CAPITAL:reversed)"
 			when 't'
-				puti btm, "Toggle (h)idden_files (d)irs_first (c)olor (f)ilepreview (p)review (w)idebar"
+				puti btm, "Toggle (h)idden_files (d)irs_first (f)ilepreview (p)review (w)idebar"
 			else
 				attr_set(Color.base)
 				attr_set(Color.info)
diff --git a/code/fm.rb b/code/fm.rb
index c69cefb1..f172840f 100644
--- a/code/fm.rb
+++ b/code/fm.rb
@@ -1,16 +1,5 @@
 require 'thread'
 
-OPTIONS = {
-	'hidden' => false,
-	'sort' => :name,
-	'dir_first' => true,
-	'sort_reverse' => false,
-	'color' => true,
-	'wide_bar' => true,
-	'filepreview' => true,
-	'preview' => true,
-}
-
 ## methods:
 ## initialize(pwd=nil)
 ## refresh
diff --git a/code/keys.rb b/code/keys.rb
index 0498f6f6..b652ff92 100644
--- a/code/keys.rb
+++ b/code/keys.rb
@@ -134,8 +134,8 @@ module Fm
 			closei
 			system('clear')
 			ls = ['ls']
-			ls << '--color=auto' if OPTIONS['color']
-			ls << '--group-directories-first' if OPTIONS['color']
+			ls << '--color=auto' if Option.color
+			ls << '--group-directories-first' if Option.color
 			system(*ls)
 			system('bash')
 			@pwd.schedule
@@ -143,21 +143,21 @@ module Fm
 
 
 		when /^S(.)$/
-			OPTIONS['sort_reverse'] = $1.ord.between?(65, 90)
+			Option.sort_reverse = $1.ord.between?(65, 90)
 
 			case $1
 			when 'n'
-				OPTIONS['sort'] = :name
+				Option.sort = :name
 			when 'e'
-				OPTIONS['sort'] = :ext
+				Option.sort = :ext
 			when 't'
-				OPTIONS['sort'] = :type
+				Option.sort = :type
 			when 's'
-				OPTIONS['sort'] = :size
+				Option.sort = :size
 			when 'm'
-				OPTIONS['sort'] = :mtime
+				Option.sort = :mtime
 			when 'c'
-				OPTIONS['sort'] = :ctime
+				Option.sort = :ctime
 			end
 			@pwd.schedule
 
@@ -379,23 +379,20 @@ module Fm
 			end
 
 		when 'tw'
-			OPTIONS['wide_bar'] ^= true
+			Option.wide_bar ^= true
 
 		when 'tp'
-			OPTIONS['preview'] ^= true
-
-		when 'tc'
-			OPTIONS['color'] ^= true
+			Option.preview ^= true
 
 		when 'tf'
-			OPTIONS['filepreview'] ^= true
+			Option.file_preview ^= true
 
 		when 'th'
-			OPTIONS['hidden'] ^= true
+			Option.show_hidden ^= true
 			@pwd.refresh!
 
 		when 'td'
-			OPTIONS['dir_first'] ^= true
+			Option.dir_first ^= true
 			@pwd.schedule
 
 		when 'delete'
diff --git a/ranger.conf b/ranger.conf
new file mode 100644
index 00000000..ed72113d
--- /dev/null
+++ b/ranger.conf
@@ -0,0 +1,9 @@
+Option.show_hidden  = false
+Option.sort         = :name
+Option.dir_first    = true
+Option.sort_reverse = false
+Option.colorscheme  = 'default'
+Option.wide_bar     = true
+Option.file_preview = true
+Option.preview      = true
+
diff --git a/ranger.rb b/ranger.rb
index 797e978c..36b9656d 100755
--- a/ranger.rb
+++ b/ranger.rb
@@ -28,9 +28,26 @@ for file in Dir.glob "#{MYDIR}/code/**/*.rb"
 	require file [MYDIR.size + 1 ... -3]
 end
 
+## default options
+opt = {
+	:show_hidden => false,
+	:sort => :name,
+	:dir_first => true,
+	:sort_reverse => false,
+	:colorscheme => true,
+	:wide_bar => true,
+	:file_preview => true,
+	:preview => true,
+	:colorscheme => 'default'
+}
+
+Option = Struct.new(*opt.keys).new(*opt.values)
+opt = nil
+
+load 'ranger.conf'
 load 'data/types.rb'
 load 'data/apps.rb'
-load 'data/colorscheme/default.rb'
+load 'data/colorscheme/' + Option.colorscheme + '.rb'
 load 'data/screensaver/clock.rb'
 
 include Debug
/span> ^
4a943d4e ^


a97886ef ^
4a943d4e ^




2b36eee9 ^
37c85905 ^














48bde7f9 ^











2b36eee9 ^







4aff81ec ^



2b36eee9 ^



02684e8d ^
2b36eee9 ^











4aff81ec ^
2b36eee9 ^
8fd7deed ^
4aff81ec ^

48bde7f9 ^




2b36eee9 ^
d2f360d8 ^
1209ddac ^
d2f360d8 ^
d2f360d8 ^
a97886ef ^
1209ddac ^



cb2344a2 ^
1209ddac ^


2b36eee9 ^

4aff81ec ^
adceed3d ^
4aff81ec ^

48f993d0 ^
4aff81ec ^









2b36eee9 ^
4aff81ec ^
8fd7deed ^
4aff81ec ^
2b36eee9 ^
4aff81ec ^




2b36eee9 ^
2b36eee9 ^






9d622b12 ^

2b36eee9 ^









fbc21293 ^






2b36eee9 ^





4a943d4e ^























































































2b36eee9 ^
2b36eee9 ^




4a943d4e ^

2b36eee9 ^

4aff81ec ^


4a943d4e ^








a97886ef ^





















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