Show More
@@ -11,19 +11,31 b' ip = IPython.ipapi.get()' | |||||
11 | from IPython.Itpl import itplns |
|
11 | from IPython.Itpl import itplns | |
12 | import os |
|
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 | def call_editor(self, file, line): |
|
21 | def call_editor(self, file, line): | |
16 | if line is None: |
|
22 | if line is None: | |
17 | line = 0 |
|
23 | line = 0 | |
18 | cmd = itplns(run_template, locals()) |
|
24 | cmd = itplns(run_template, locals()) | |
19 | print ">",cmd |
|
25 | print ">",cmd | |
20 | os.system(cmd) |
|
26 | os.system(cmd) | |
|
27 | if wait: | |||
|
28 | raw_input("Press Enter when done editing:") | |||
21 |
|
29 | |||
22 | ip.set_hook('editor',call_editor) |
|
30 | ip.set_hook('editor',call_editor) | |
23 |
|
31 | |||
24 | def komodo(exe = 'komodo'): |
|
32 | def komodo(exe = 'komodo'): | |
25 | """ Warning - komodo does not block """ |
|
33 | """ Activestate Komodo [Edit] | |
26 | install_editor(exe + ' -l $line "$file"') |
|
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 | def scite(exe = "scite"): |
|
40 | def scite(exe = "scite"): | |
29 | """ Exe is the executable name of your scite. |
|
41 | """ Exe is the executable name of your scite. |
General Comments 0
You need to be logged in to leave comments.
Login now