summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-04-27 00:48:09 +0200
committerhut <hut@lavabit.com>2010-04-27 00:48:09 +0200
commit9247ff0133a2624f82fd61609b5aa55c2ea2ffa9 (patch)
treed812f5d2707e111006cb85a6525c7313cca77043
parente209b66101e475a0aa85d5eed3dbe0e8307ffba0 (diff)
downloadranger-9247ff0133a2624f82fd61609b5aa55c2ea2ffa9.tar.gz
defaults.commands: added optional "minus" argument for :mark
-rw-r--r--ranger/defaults/commands.py9
-rw-r--r--ranger/help/console.py3
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>
25 20:47:26 +0200 Small base64.nim refactor (#5755)' href='/ahoang/Nim/commit/lib/pure/base64.nim?h=devel&id=6ac37ee2fbfdd46f2ddffbd98eb64994a490d841'>6ac37ee2f ^
d69e8f4de ^
6ac37ee2f ^



d69e8f4de ^

43bddf62d ^

d69e8f4de ^


996512309 ^

43bddf62d ^
d69e8f4de ^




0fad659bf ^
6ac37ee2f ^

d69e8f4de ^

43bddf62d ^
d69e8f4de ^



6ac37ee2f ^
d69e8f4de ^






8cd4ec978 ^

d69e8f4de ^
69d4eb14b ^
d69e8f4de ^
43bddf62d ^

d69e8f4de ^
6b002e805 ^


d69e8f4de ^
43bddf62d ^


d69e8f4de ^
6b002e805 ^

d69e8f4de ^
43bddf62d ^

d69e8f4de ^






43bddf62d ^
d69e8f4de ^






0fad659bf ^
6ac37ee2f ^

d69e8f4de ^
0fad659bf ^
d69e8f4de ^
6ac37ee2f ^




43bddf62d ^
d69e8f4de ^







43bddf62d ^
d69e8f4de ^


43bddf62d ^
d69e8f4de ^




43bddf62d ^
996512309 ^

d69e8f4de ^
43bddf62d ^
d69e8f4de ^



996512309 ^

d69e8f4de ^

996512309 ^
6ac37ee2f ^
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177