diff options
author | hut <hut@lavabit.com> | 2010-04-27 00:48:09 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-04-27 00:48:09 +0200 |
commit | 9247ff0133a2624f82fd61609b5aa55c2ea2ffa9 (patch) | |
tree | d812f5d2707e111006cb85a6525c7313cca77043 /ranger | |
parent | e209b66101e475a0aa85d5eed3dbe0e8307ffba0 (diff) | |
download | ranger-9247ff0133a2624f82fd61609b5aa55c2ea2ffa9.tar.gz |
defaults.commands: added optional "minus" argument for :mark
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/defaults/commands.py | 9 | ||||
-rw-r--r-- | ranger/help/console.py | 3 |
2 files changed, 8 insertions, 4 deletions
diff --git a/ranger/defaults/commands.py b/ranger/defaults/commands.py index d4c00f60..53d7a475 100644 --- a/ranger/defaults/commands.py +++ b/ranger/defaults/commands.py @@ -280,23 +280,26 @@ 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. """ def execute(self): import re cwd = self.fm.env.cwd line = parse(self.line) - input = line.rest(1) + mark_them = line.chunk(1) != "-" + input = line.rest(mark_them and 1 or 2) 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=True) + cwd.mark_item(fileobj, val=mark_them) class mkdir(Command): diff --git a/ranger/help/console.py b/ranger/help/console.py index d88cc267..a85af677 100644 --- a/ranger/help/console.py +++ b/ranger/help/console.py @@ -94,8 +94,9 @@ 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. :mkdir <dirname> Creates a directory with the name <dirname> |