summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCélestin Matte <celestin.matte@gmail.com>2014-04-28 19:42:45 +0200
committerCélestin Matte <celestin.matte@gmail.com>2014-04-28 19:56:56 +0200
commit04681ff7ceb8a7db4111dbfac5f06477561c4c4a (patch)
tree92084599e4470814c239e18f52cb50c1164aa86a
parent3e31022b943f33f0466f9f5b7b452cf2363bfb40 (diff)
downloadranger-04681ff7ceb8a7db4111dbfac5f06477561c4c4a.tar.gz
Handle CDPATH
This shell feature allows one to cd directly to remote directories located
in paths defined in the variable. Allow handling of such variable in ranger.
Compatible with: bash, ksh, zsh, csh, and possibly others.
-rw-r--r--ranger/core/actions.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index ec853f1b..8424b51d 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -451,7 +451,19 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
     def enter_dir(self, path, remember=False, history=True):
         """Enter the directory at the given path"""
         cwd = self.thisdir
+        # bash and ksh syntax
+        cdpath = os.environ.get('CDPATH', None)
+        if cdpath == "":
+            # zsh and csh syntax
+            os.environ.get('cdpath', None)
+        paths = cdpath.split(':')
         result = self.thistab.enter_dir(path, history=history)
+        if result == 0:
+            for p in paths:
+                curpath = p + '/' + path
+                if os.path.isdir(curpath):
+                    result = self.thistab.enter_dir(curpath, history=history)
+                    break
         if cwd != self.thisdir:
             if remember:
                 self.bookmarks.remember(cwd)
tml/002test.cc.html?h=main&id=d44123cabaa730c778a0e2644c75dbfba6a7ab30'>d44123ca ^
90560d71 ^
672e3e50 ^





















90560d71 ^
672e3e50 ^

90560d71 ^
672e3e50 ^


90560d71 ^


672e3e50 ^

90560d71 ^
672e3e50 ^
65361948 ^
672e3e50 ^




90560d71 ^
672e3e50 ^
65361948 ^
672e3e50 ^








90560d71 ^
672e3e50 ^



90560d71 ^
672e3e50 ^



90560d71 ^
672e3e50 ^
90560d71 ^
62a52ffb ^
672e3e50 ^



90560d71 ^
672e3e50 ^


65361948 ^

672e3e50 ^



90560d71 ^

672e3e50 ^






90560d71 ^
672e3e50 ^

90560d71 ^



672e3e50 ^

90560d71 ^

c5ffb6e1 ^
90560d71 ^

672e3e50 ^



90560d71 ^









672e3e50 ^





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