diff options
author | hut <hut@lavabit.com> | 2013-01-01 18:49:17 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2013-01-01 18:49:17 +0100 |
commit | cfc8a68eed60d6f898130a1203c07949c6f82de5 (patch) | |
tree | 09354af032eeb6e9b9fc07faccaf04d9e1de6662 /ranger | |
parent | 07b79215a381757cd1fe93ff365add8db696b65e (diff) | |
download | ranger-cfc8a68eed60d6f898130a1203c07949c6f82de5.tar.gz |
config/commands: Added commands 'mark_tag' and 'unmark_tag'
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/config/commands.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py index 3a3b84c4..07c595e0 100644 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -548,6 +548,31 @@ class mark(Command): self.fm.ui.need_redraw = True +class mark_tag(Command): + """ + :mark_tag [<tags>] + + Mark all tags that are tagged with either of the given tags. + When leaving out the tag argument, all tagged files are marked. + """ + do_mark = True + + def execute(self): + cwd = self.fm.thisdir + tags = self.rest(1).replace(" ","") + if not self.fm.tags: + return + for fileobj in cwd.files: + try: + tag = self.fm.tags.tags[fileobj.realpath] + except KeyError: + continue + if not tags or tag in tags: + cwd.mark_item(fileobj, val=self.do_mark) + self.fm.ui.status.need_redraw = True + self.fm.ui.need_redraw = True + + class console(Command): """ :console <command> @@ -615,6 +640,16 @@ class unmark(mark): do_mark = False +class unmark_tag(mark_tag): + """ + :unmark_tag [<tags>] + + Unmark all tags that are tagged with either of the given tags. + When leaving out the tag argument, all tagged files are unmarked. + """ + do_mark = False + + class mkdir(Command): """ :mkdir <dirname> |