Show More
@@ -3,6 +3,10 b' syntax: glob' | |||||
3 | *~ |
|
3 | *~ | |
4 | *.tmp |
|
4 | *.tmp | |
5 | *.pyc |
|
5 | *.pyc | |
|
6 | *.bak | |||
|
7 | *.tgz | |||
|
8 | *.org | |||
|
9 | *.rej | |||
6 | .svn/ |
|
10 | .svn/ | |
7 | .bzr/ |
|
11 | .bzr/ | |
8 | .settings/ |
|
12 | .settings/ |
@@ -131,6 +131,11 b' def rep_f(self, arg):' | |||||
131 | Repeat the specified lines immediately. Input slice syntax is the same as |
|
131 | Repeat the specified lines immediately. Input slice syntax is the same as | |
132 | in %macro and %save. |
|
132 | in %macro and %save. | |
133 |
|
133 | |||
|
134 | %rep foo | |||
|
135 | ||||
|
136 | Place the most recent line that has the substring "foo" to next input. | |||
|
137 | (e.g. 'svn ci -m foobar'). | |||
|
138 | ||||
134 | """ |
|
139 | """ | |
135 |
|
140 | |||
136 |
|
141 | |||
@@ -140,7 +145,7 b' def rep_f(self, arg):' | |||||
140 | ip.set_next_input(str(ip.user_ns["_"])) |
|
145 | ip.set_next_input(str(ip.user_ns["_"])) | |
141 | return |
|
146 | return | |
142 |
|
147 | |||
143 | if len(args) == 1: |
|
148 | if len(args) == 1 and not '-' in args[0]: | |
144 | arg = args[0] |
|
149 | arg = args[0] | |
145 | if len(arg) > 1 and arg.startswith('0'): |
|
150 | if len(arg) > 1 and arg.startswith('0'): | |
146 | # get from shadow hist |
|
151 | # get from shadow hist | |
@@ -155,6 +160,13 b' def rep_f(self, arg):' | |||||
155 | except ValueError: |
|
160 | except ValueError: | |
156 | pass |
|
161 | pass | |
157 |
|
162 | |||
|
163 | for h in reversed(self.shell.input_hist_raw): | |||
|
164 | if 'rep' in h: | |||
|
165 | continue | |||
|
166 | if fnmatch.fnmatch(h,'*' + arg + '*'): | |||
|
167 | ip.set_next_input(str(h).rstrip()) | |||
|
168 | return | |||
|
169 | ||||
158 |
|
170 | |||
159 | lines = self.extract_input_slices(args, True) |
|
171 | lines = self.extract_input_slices(args, True) | |
160 | print "lines",lines |
|
172 | print "lines",lines |
General Comments 0
You need to be logged in to leave comments.
Login now