Show More
@@ -0,0 +1,31 b'' | |||||
|
1 | """ 'editor' hooks for common editors that work well with ipython | |||
|
2 | ||||
|
3 | They should honor the line number argument, at least. | |||
|
4 | ||||
|
5 | Contributions are *very* welcome. | |||
|
6 | """ | |||
|
7 | ||||
|
8 | import IPython.ipapi | |||
|
9 | ip = IPython.ipapi.get() | |||
|
10 | ||||
|
11 | from IPython.Itpl import itplns | |||
|
12 | import os | |||
|
13 | ||||
|
14 | def install_editor(run_template): | |||
|
15 | def call_editor(self, file, line): | |||
|
16 | if line is None: | |||
|
17 | line = 0 | |||
|
18 | cmd = itplns(run_template, locals()) | |||
|
19 | print ">",cmd | |||
|
20 | os.system(cmd) | |||
|
21 | ||||
|
22 | ip.set_hook('editor',call_editor) | |||
|
23 | ||||
|
24 | def komodo(exe = 'komodo'): | |||
|
25 | """ Warning - komodo does not block """ | |||
|
26 | install_editor(exe + ' -l $line "$file"') | |||
|
27 | ||||
|
28 | def scite(exe = "scite"): | |||
|
29 | """ Exe is the executable name of your scite. | |||
|
30 | """ | |||
|
31 | install_editor(exe + ' "$file" -goto:$line') No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now