Show More
@@ -11,19 +11,31 b' ip = IPython.ipapi.get()' | |||
|
11 | 11 | from IPython.Itpl import itplns |
|
12 | 12 | import os |
|
13 | 13 | |
|
14 | def install_editor(run_template): | |
|
14 | def install_editor(run_template, wait = False): | |
|
15 | """ Gets a template in format "myeditor bah bah $file bah bah $line | |
|
16 | ||
|
17 | Installs the editor that is called by IPython, instead of the default | |
|
18 | notepad or vi. | |
|
19 | """ | |
|
20 | ||
|
15 | 21 | def call_editor(self, file, line): |
|
16 | 22 | if line is None: |
|
17 | 23 | line = 0 |
|
18 | 24 | cmd = itplns(run_template, locals()) |
|
19 | 25 | print ">",cmd |
|
20 | 26 | os.system(cmd) |
|
27 | if wait: | |
|
28 | raw_input("Press Enter when done editing:") | |
|
21 | 29 | |
|
22 | 30 | ip.set_hook('editor',call_editor) |
|
23 | 31 | |
|
24 | 32 | def komodo(exe = 'komodo'): |
|
25 | """ Warning - komodo does not block """ | |
|
26 | install_editor(exe + ' -l $line "$file"') | |
|
33 | """ Activestate Komodo [Edit] | |
|
34 | ||
|
35 | Warning - komodo does not block, so can't be used for plain %edit | |
|
36 | ||
|
37 | """ | |
|
38 | install_editor(exe + ' -l $line "$file"', wait = True) | |
|
27 | 39 | |
|
28 | 40 | def scite(exe = "scite"): |
|
29 | 41 | """ Exe is the executable name of your scite. |
General Comments 0
You need to be logged in to leave comments.
Login now