summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--HACKING4
-rw-r--r--README2
-rw-r--r--doc/colorschemes.txt4
-rw-r--r--doc/ranger.19
-rwxr-xr-xranger.py6
-rw-r--r--ranger/__init__.py5
-rw-r--r--ranger/__main__.py2
-rw-r--r--ranger/core/actions.py2
-rw-r--r--ranger/defaults/apps.py4
-rw-r--r--ranger/defaults/commands.py2
-rw-r--r--ranger/defaults/keys.py2
-rw-r--r--ranger/defaults/options.py2
-rw-r--r--ranger/gui/colorscheme.py6
13 files changed, 29 insertions, 21 deletions
diff --git a/HACKING b/HACKING
index 9c114e89..0424b047 100644
--- a/HACKING
+++ b/HACKING
@@ -56,13 +56,13 @@ assuming <self> is a "SettingsAware" object.
 
 * Changing commands, adding aliases:
 ranger/defaults/commands.py
-or ~/.ranger/commands.py
+or ~/.config/ranger/commands.py
 
 * Adding colorschemes:
 Copy ranger/colorschemes/default.py to ranger/colorschemes/myscheme.py
 and modify it according to your needs.  Alternatively, mimic the jungle
 colorscheme.  It subclasses the default scheme and just modifies a few things.
-In ranger/defaults/options.py (or ~/.ranger/options.py), change
+In ranger/defaults/options.py (or ~/.config/ranger/options.py), change
     colorscheme = 'default'
 to: colorscheme = 'myscheme'
 
diff --git a/README b/README
index dad70262..babcfbbb 100644
--- a/README
+++ b/README
@@ -75,7 +75,7 @@ parent directories and to the right there's a preview of the object you're
 pointing at.  Now use the Arrow Keys to navigate, Enter to open a file
 or type Q to quit.
 
-To customize ranger, copy the files from ranger/defaults/ to ~/.ranger/
+To customize ranger, copy the files from ranger/defaults/ to ~/.config/ranger/
 and modify them according to your wishes.
 
 
diff --git a/doc/colorschemes.txt b/doc/colorschemes.txt
index 905c7a3e..e7bc2c0a 100644
--- a/doc/colorschemes.txt
+++ b/doc/colorschemes.txt
@@ -65,7 +65,7 @@ Specify a Colorscheme
 ---------------------
 
 Colorschemes are searched for in these directories:
-~/.ranger/colorschemes/
+~/.config/ranger/colorschemes/
 /ranger/colorschemes/
 
 To specify which colorscheme to use, define the variable "colorscheme"
@@ -73,7 +73,7 @@ in your options.py:
 colorscheme = colorschemes.default
 
 This means, use the (one) colorscheme contained in
-either ~/.ranger/colorschemes/default.py or /ranger/colorschemes/default.py.
+either ~/.config/ranger/colorschemes/default.py or /ranger/colorschemes/default.py.
 
 You can define more than one colorscheme in a colorscheme file.  The
 one named "Scheme" will be chosen in that case.  If there is no colorscheme
diff --git a/doc/ranger.1 b/doc/ranger.1
index 3db90285..fab42496 100644
--- a/doc/ranger.1
+++ b/doc/ranger.1
@@ -38,7 +38,8 @@ Return the exit code 1 if ranger is used to run a file, for example with
 `ranger --fail-unless-cd filename`.  This can be useful for scripts.
 .TP
 -r \fIdir\fR, --confdir=\fIdir\fR
-Define a different configuration directory.  The default is $HOME/.ranger.
+Define a different configuration directory.  The default is
+$XDG_CONFIG_HOME/ranger (which defaults to ~/.config/ranger)
 .TP
 -m \fIn\fR, --mode=\fIn\fR
 When a filename is supplied, make it run in mode \fIn\fR. Check the
@@ -177,17 +178,17 @@ of your parent shell after exiting ranger:
 
 ranger() {
     command ranger --fail-unless-cd $@ &&
-    cd "$(grep \\^\\' ~/.ranger/bookmarks | cut -b3-)"
+    cd "$(grep \\^\\' ~/.config/ranger/bookmarks | cut -b3-)"
 }
 .\"-----------------------------------------
 .SH CONFIGURATION
 The files in
 .B ranger/defaults/
 can be copied into your configuration directory (by default, this is
-$HOME/.ranger) and customized according to your wishes.  
+~/.config/ranger) and customized according to your wishes.
 Most files don't have to be copied completely though: Just define those
 settings you want to add or change and they will override the defauls.
-Colorschemes can be placed in $HOME/.ranger/colorschemes.
+Colorschemes can be placed in ~/.config/ranger/colorschemes.
 .P
 All configuration is done in Python.
 Each configuration file should contain sufficient documentation.
diff --git a/ranger.py b/ranger.py
index f290d796..cc7f14ed 100755
--- a/ranger.py
+++ b/ranger.py
@@ -23,7 +23,11 @@
 # after you exit ranger by starting it with: source ranger ranger
 """":
 if [ $1 ]; then
-	$@ --fail-unless-cd && cd "$(grep \^\' ~/.ranger/bookmarks | cut -b3-)"
+	if [ -z $XDG_CONFIG_HOME ]; then
+		$@ --fail-unless-cd && cd "$(grep \^\' ~/.config/ranger/bookmarks | cut -b3-)"
+	else
+		$@ --fail-unless-cd && cd "$(grep \^\' "$XDG_CONFIG_HOME"/ranger/bookmarks | cut -b3-)"
+	fi
 else
 	echo "usage: source path/to/ranger.py path/to/ranger.py"
 fi
diff --git a/ranger/__init__.py b/ranger/__init__.py
index e0e8e1bf..57e0e5a2 100644
--- a/ranger/__init__.py
+++ b/ranger/__init__.py
@@ -31,7 +31,10 @@ Copyright (C) 2009, 2010  Roman Zimbelmann <romanz@lavabit.com>
 """
 
 USAGE = '%prog [options] [path/filename]'
-DEFAULT_CONFDIR = '~/.ranger'
+if 'XDG_CONFIG_HOME' in os.environ and os.environ['XDG_CONFIG_HOME']:
+	DEFAULT_CONFDIR = os.environ['XDG_CONFIG_HOME'] + '/ranger'
+else:
+	DEFAULT_CONFDIR = '~/.config/ranger'
 RANGERDIR = os.path.dirname(__file__)
 LOGFILE = '/tmp/errorlog'
 arg = OpenStruct(
diff --git a/ranger/__main__.py b/ranger/__main__.py
index b3a41776..28284ef5 100644
--- a/ranger/__main__.py
+++ b/ranger/__main__.py
@@ -113,7 +113,7 @@ def load_settings(fm, clean):
 			pass
 		# COMPAT WARNING
 		if hasattr(keys, 'initialize_commands'):
-			print("Warning: the syntax for ~/.ranger/keys.py has changed.")
+			print("Warning: the syntax for ~/.config/ranger/keys.py has changed.")
 			print("Your custom keys are not loaded."\
 					"  Please update your configuration.")
 		allow_access_to_confdir(ranger.arg.confdir, False)
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index d12d9c6c..a5ee0d4d 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -423,7 +423,7 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 	# --------------------------
 	# -- Tags
 	# --------------------------
-	# Tags are saved in ~/.ranger/tagged and simply mark if a
+	# Tags are saved in ~/.config/ranger/tagged and simply mark if a
 	# file is important to you in any context.
 
 	def tag_toggle(self, movedown=None):
diff --git a/ranger/defaults/apps.py b/ranger/defaults/apps.py
index 48735196..47eff0c9 100644
--- a/ranger/defaults/apps.py
+++ b/ranger/defaults/apps.py
@@ -17,13 +17,13 @@
 This is the default ranger configuration file for filetype detection
 and application handling.
 
-You can place this file in your ~/.ranger/ directory and it will be used
+You can place this file in your ~/.config/ranger/ directory and it will be used
 instead of this one.  Though, to minimize your effort when upgrading ranger,
 you may want to subclass CustomApplications rather than making a full copy.
             
 This example modifies the behaviour of "feh" and adds a custom media player:
 
-#### start of the ~/.ranger/apps.py example
+#### start of the ~/.config/ranger/apps.py example
 	from ranger.defaults.apps import CustomApplications as DefaultApps
 	from ranger.api.apps import *
 			
diff --git a/ranger/defaults/commands.py b/ranger/defaults/commands.py
index f1c92274..b6bf7e2b 100644
--- a/ranger/defaults/commands.py
+++ b/ranger/defaults/commands.py
@@ -32,7 +32,7 @@ The return value for quick() can be:
 The return value for execute() doesn't matter.
 
 If you want to add custom commands, you can create a file
-~/.ranger/commands.py, add the line:
+~/.config/ranger/commands.py, add the line:
 	from ranger.api.commands import *
 
 and write some command definitions, for example:
diff --git a/ranger/defaults/keys.py b/ranger/defaults/keys.py
index e72f4c91..7d8ccc4a 100644
--- a/ranger/defaults/keys.py
+++ b/ranger/defaults/keys.py
@@ -58,7 +58,7 @@ dgg       => fm.cut(foo=bar, dirarg=Direction(to=0))
 5dgg      => fm.cut(foo=bar, narg=5, dirarg=Direction(to=0))
 5d3gg     => fm.cut(foo=bar, narg=5, dirarg=Direction(to=3))
 
-Example ~/.ranger/keys.py
+Example ~/.config/ranger/keys.py
 -------------------------
 from ranger.api.keys import *
 
diff --git a/ranger/defaults/options.py b/ranger/defaults/options.py
index d3c420af..126d4bad 100644
--- a/ranger/defaults/options.py
+++ b/ranger/defaults/options.py
@@ -17,7 +17,7 @@
 This is the default configuration file of ranger.
 
 There are two ways of customizing ranger.  The first and recommended
-method is creating a file at ~/.ranger/options.py and adding
+method is creating a file at ~/.config/ranger/options.py and adding
 those lines you want to change.  It might look like this:
 
 from ranger.api.options import *
diff --git a/ranger/gui/colorscheme.py b/ranger/gui/colorscheme.py
index 501b8788..5b317acb 100644
--- a/ranger/gui/colorscheme.py
+++ b/ranger/gui/colorscheme.py
@@ -24,7 +24,7 @@ The values are specified in ranger.gui.color.
 A colorscheme must...
 
 1. be inside either of these directories:
-~/.ranger/colorschemes/
+~/.config/ranger/colorschemes/
 path/to/ranger/colorschemes/
 
 2. be a subclass of ranger.gui.colorscheme.ColorScheme
@@ -121,7 +121,7 @@ class ColorScheme(SettingsAware):
 		return fg, -1, attr
 
 def _colorscheme_name_to_class(signal):
-	# Find the colorscheme.  First look for it at ~/.ranger/colorschemes,
+	# Find the colorscheme.  First look for it at ~/.config/ranger/colorschemes,
 	# then at RANGERDIR/colorschemes.  If the file contains a class
 	# named Scheme, it is used.  Otherwise, an arbitrary other class
 	# is picked.
@@ -139,7 +139,7 @@ def _colorscheme_name_to_class(signal):
 		except:
 			return False
 
-	# create ~/.ranger/colorschemes/__init__.py if it doesn't exist
+	# create ~/.config/ranger/colorschemes/__init__.py if it doesn't exist
 	if usecustom:
 		if os.path.exists(ranger.relpath_conf('colorschemes')):
 			initpy = ranger.relpath_conf('colorschemes', '__init__.py')
til_generatorized.html?h=v1.4.2&id=f07bb12fc5c59430e995a64956b36331ce3629b9'>f07bb12f ^
ef0157ff ^
f07bb12f ^









ef0157ff ^

f07bb12f ^

ef0157ff ^






f07bb12f ^

ef0157ff ^
f07bb12f ^
ef0157ff ^
34a60763 ^
f07bb12f ^






3e18db75 ^
f07bb12f ^



f07bb12f ^
34a60763 ^
f07bb12f ^





















34a60763 ^
f07bb12f ^



























3e18db75 ^
f07bb12f ^
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