summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorCiro Santilli <ciro.santilli@gmail.com>2016-03-21 12:02:17 +0100
committerCiro Santilli <ciro.santilli@gmail.com>2016-03-21 12:02:17 +0100
commitf6bdde502d0a08f80783e4035d09543f821bc72a (patch)
treecb56fec21c1393daa3defe899b8c775dec530555 /ranger
parent09c30cdf4b9050d548e12b5108581680357ac5f1 (diff)
downloadranger-f6bdde502d0a08f80783e4035d09543f821bc72a.tar.gz
set_bookmark for directories other than the current
Sample usage:

    :set_bookmark a /home/me/a

Motivation: make it easier to set bookmarks from environment variables
on rc.conf.
Diffstat (limited to 'ranger')
-rw-r--r--ranger/core/actions.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 89924dc0..32b8925e 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -23,6 +23,7 @@ from ranger.ext.next_available_filename import next_available_filename
 from ranger.ext.rifle import squash_flags, ASK_COMMAND
 from ranger.core.shared import FileManagerAware, SettingsAware
 from ranger.core.tab import Tab
+from ranger.container.directory import Directory
 from ranger.container.file import File
 from ranger.core.loader import CommandLoader, CopyLoader
 from ranger.container.settings import ALLOWED_SETTINGS
@@ -782,10 +783,14 @@ class Actions(FileManagerAware, SettingsAware):
         except KeyError:
             pass
 
-    def set_bookmark(self, key):
+    def set_bookmark(self, key, val=None):
         """Set the bookmark with the name <key> to the current directory"""
+        if val is None:
+            val = self.thisdir
+        else:
+            val = Directory(val)
         self.bookmarks.update_if_outdated()
-        self.bookmarks[str(key)] = self.thisdir
+        self.bookmarks[str(key)] = val
 
     def unset_bookmark(self, key):
         """Delete the bookmark with the name <key>"""
'>24a60449 ^
5c97dcd7 ^

24a60449 ^

76fe37ef ^



















76fe37ef ^




8f0bc28b ^




















8f0bc28b ^




76fe37ef ^





76fe37ef ^









7f962895 ^
76fe37ef ^

7f962895 ^


04605a5f ^
7f962895 ^

24a60449 ^




76fe37ef ^


7f962895 ^

76fe37ef ^

24a60449 ^
8f0bc28b ^

24a60449 ^

8f0bc28b ^

76fe37ef ^
24a60449 ^
8f0bc28b ^

76fe37ef ^


76fe37ef ^
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