Show More
@@ -483,8 +483,9 b' def lee_f(self,s):' | |||||
483 | """ Open file(s)/objects in Leo |
|
483 | """ Open file(s)/objects in Leo | |
484 |
|
484 | |||
485 | - %lee hist -> open full session history in leo |
|
485 | - %lee hist -> open full session history in leo | |
486 | - Takes an object |
|
486 | - Takes an object. l = [1,2,"hello"]; %lee l. Alt+I in leo pushes the object back | |
487 |
- Takes an mglob pattern, e.g. '%lee *.cpp' or %le |
|
487 | - Takes an mglob pattern, e.g. '%lee *.cpp' or %lee 'rec:*.cpp' | |
|
488 | - Takes input history indices: %lee 4 6-8 10 12-47 | |||
488 | """ |
|
489 | """ | |
489 | import os |
|
490 | import os | |
490 |
|
491 | |||
@@ -496,6 +497,13 b' def lee_f(self,s):' | |||||
496 | return |
|
497 | return | |
497 |
|
498 | |||
498 |
|
499 | |||
|
500 | if s and s[0].isdigit(): | |||
|
501 | # numbers; push input slices to leo | |||
|
502 | lines = self.extract_input_slices(s.strip().split(), True) | |||
|
503 | v = add_var('stored_ipython_input') | |||
|
504 | v.b = '\n'.join(lines) | |||
|
505 | return | |||
|
506 | ||||
499 |
|
507 | |||
500 | # try editing the object directly |
|
508 | # try editing the object directly | |
501 | obj = ip.user_ns.get(s, None) |
|
509 | obj = ip.user_ns.get(s, None) | |
@@ -503,6 +511,7 b' def lee_f(self,s):' | |||||
503 | edit_object_in_leo(obj,s) |
|
511 | edit_object_in_leo(obj,s) | |
504 | return |
|
512 | return | |
505 |
|
|
513 | ||
|
514 | ||||
506 | # if it's not object, it's a file name / mglob pattern |
|
515 | # if it's not object, it's a file name / mglob pattern | |
507 | from IPython.external import mglob |
|
516 | from IPython.external import mglob | |
508 |
|
517 |
General Comments 0
You need to be logged in to leave comments.
Login now