diff options
author | Ciro Santilli <ciro.santilli@gmail.com> | 2016-03-21 12:02:17 +0100 |
---|---|---|
committer | Ciro Santilli <ciro.santilli@gmail.com> | 2016-03-21 12:02:17 +0100 |
commit | f6bdde502d0a08f80783e4035d09543f821bc72a (patch) | |
tree | cb56fec21c1393daa3defe899b8c775dec530555 /ranger | |
parent | 09c30cdf4b9050d548e12b5108581680357ac5f1 (diff) | |
download | ranger-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.py | 9 |
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>""" |