summary refs log tree commit diff stats
path: root/ranger.py
diff options
context:
space:
mode:
Diffstat (limited to 'ranger.py')
-rwxr-xr-xranger.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/ranger.py b/ranger.py
index 2e380581..64ea365e 100755
--- a/ranger.py
+++ b/ranger.py
@@ -1,25 +1,38 @@
 #!/usr/bin/python -OO
 # coding=utf-8
 # ranger: Browse your files inside the terminal.
-
+# -----------------------------------------------------------------------------
 
 # An embedded shell script. Assuming this file is /usr/bin/ranger,
 # this hack allows you to use the cd-after-exit feature by typing:
-# source ranger ranger
+#   source ranger ranger
 # Now when you quit ranger, it should change the directory of the
 # parent shell to where you have last been in ranger.
 # Works with at least bash and zsh.
+#
+# A convenient way of using this feature is adding this line to your bashrc:
+#   alias rn='source ranger ranger'
+# or, if ranger is not installed properly:
+#   alias rn='source /path/to/ranger.py /path/to/ranger.py'
 """":
 if [ $1 ]; then
-	cd "`$1 --cd-after-exit $@ 3>&1 1>&2 2>&3 3>&-`"
+	RANGER="$1"
+	shift
+	cd "`$RANGER --cd-after-exit \"$@\" 3>&1 1>&2 2>&3 3>&-`"
 else
 	echo "usage: source path/to/ranger.py path/to/ranger.py"
 fi
 return 1
 """
 
+# Redefine the docstring, since the previous one was hijacked to
+# embed a shellscript.
 __doc__ = """Ranger - file browser for the unix terminal"""
 
+
+# Importing of the main method may fail if the ranger directory
+# neither is in the same directory as this file, nor in one of
+# pythons global import paths.
 try:
 	from ranger import main
 
@akkartik.com> 2021-02-27 06:55:41 -0800 committer Kartik K. Agaram <vc@akkartik.com> 2021-02-27 06:55:41 -0800 7817' href='/akkartik/mu/commit/115write-byte.subx?h=main&id=a9e0cb7cc9da462c6e7886edfb554d7266e84c18'>a9e0cb7c ^
33352536 ^





bfcc0f85 ^
33352536 ^
6070c23e ^
d134a83b ^


33352536 ^


d134a83b ^
33352536 ^
d134a83b ^

33352536 ^

a9e0cb7c ^
7a583220 ^
33352536 ^

d134a83b ^


0e9503d7 ^
d134a83b ^










33352536 ^
d134a83b ^






33352536 ^
d134a83b ^







33352536 ^
d134a83b ^


83822d63 ^
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