diff options
author | hut <hut@lavabit.com> | 2010-04-27 00:58:06 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-04-27 00:58:06 +0200 |
commit | 02afb82787821cb76c502e2b486acddfd84792a1 (patch) | |
tree | 388c55b91e34ae6a4a477a4074e18bda715aa413 | |
parent | 4d4e468b8fdccc6ab03028dae07868826908b0a7 (diff) | |
download | ranger-02afb82787821cb76c502e2b486acddfd84792a1.tar.gz |
defaults.commands: Added :unmark
-rw-r--r-- | ranger/defaults/commands.py | 19 | ||||
-rw-r--r-- | ranger/help/console.py | 6 |
2 files changed, 17 insertions, 8 deletions
diff --git a/ranger/defaults/commands.py b/ranger/defaults/commands.py index 56287367..b53cce62 100644 --- a/ranger/defaults/commands.py +++ b/ranger/defaults/commands.py @@ -280,30 +280,37 @@ class delete(Command): class mark(Command): """ - :mark [-] <regexp> + :mark <regexp> Mark all files matching a regular expression. - - If the first argument is a "-", unmark them instead. """ + do_mark = True def execute(self): import re cwd = self.fm.env.cwd line = parse(self.line) - mark_them = line.chunk(1) != "-" - input = line.rest(mark_them and 1 or 2) + input = line.rest(1) searchflags = re.UNICODE if input.lower() == input: # "smartcase" searchflags |= re.IGNORECASE pattern = re.compile(input, searchflags) for fileobj in cwd.files: if pattern.search(fileobj.basename): - cwd.mark_item(fileobj, val=mark_them) + cwd.mark_item(fileobj, val=self.do_mark) self.fm.ui.status.need_redraw = True self.fm.ui.need_redraw = True +class unmark(mark): + """ + :unmark <regexp> + + Unmark all files matching a regular expression. + """ + do_mark = False + + class mkdir(Command): """ :mkdir <dirname> diff --git a/ranger/help/console.py b/ranger/help/console.py index a85af677..04372f38 100644 --- a/ranger/help/console.py +++ b/ranger/help/console.py @@ -94,9 +94,11 @@ it conflicts with ":cd". Looks for a string in all marked files or directory. (equivalent to "!grep [some options] -e <string> -r %s | less") -:mark [-] <regexp> +:mark <regexp> Mark all files matching a regular expression. - If the first argument is a "-", unmark them instead. + +:unmark <regexp> + Unmark all files matching a regular expression. :mkdir <dirname> Creates a directory with the name <dirname> |