Show More
@@ -16,6 +16,10 b' def install_editor(run_template, wait = False):' | |||||
16 |
|
16 | |||
17 | Installs the editor that is called by IPython, instead of the default |
|
17 | Installs the editor that is called by IPython, instead of the default | |
18 | notepad or vi. |
|
18 | notepad or vi. | |
|
19 | ||||
|
20 | If wait is true, wait until the user presses enter before returning, | |||
|
21 | to facilitate non-blocking editors that exit immediately after | |||
|
22 | the call. | |||
19 | """ |
|
23 | """ | |
20 |
|
24 | |||
21 | def call_editor(self, file, line): |
|
25 | def call_editor(self, file, line): | |
@@ -29,15 +33,47 b' def install_editor(run_template, wait = False):' | |||||
29 |
|
33 | |||
30 | ip.set_hook('editor',call_editor) |
|
34 | ip.set_hook('editor',call_editor) | |
31 |
|
35 | |||
32 | def komodo(exe = 'komodo'): |
|
|||
33 | """ Activestate Komodo [Edit] |
|
|||
34 |
|
36 | |||
35 | Warning - komodo does not block, so can't be used for plain %edit |
|
37 | # in these, exe is always the path/name of the executable. Useful | |
|
38 | # if you don't have the editor directory in your path | |||
36 |
|
39 | |||
37 | """ |
|
40 | def komodo(exe = 'komodo'): | |
|
41 | """ Activestate Komodo [Edit] """ | |||
38 | install_editor(exe + ' -l $line "$file"', wait = True) |
|
42 | install_editor(exe + ' -l $line "$file"', wait = True) | |
39 |
|
43 | |||
40 | def scite(exe = "scite"): |
|
44 | def scite(exe = "scite"): | |
41 | """ Exe is the executable name of your scite. |
|
45 | """ SciTE or Sc1 """ | |
42 | """ |
|
|||
43 | install_editor(exe + ' "$file" -goto:$line') |
|
46 | install_editor(exe + ' "$file" -goto:$line') | |
|
47 | ||||
|
48 | def notepadplusplus(exe = 'notepad++'): | |||
|
49 | """ Notepad++ http://notepad-plus.sourceforge.net """ | |||
|
50 | install_editor(exe + ' -n$line "$file"') | |||
|
51 | ||||
|
52 | def jed(exe = 'jed'): | |||
|
53 | """ JED, the lightweight emacsish editor """ | |||
|
54 | install_editor(exe + ' +$line "$file"') | |||
|
55 | ||||
|
56 | def idle(exe = None): | |||
|
57 | """ Idle, the editor bundled with python | |||
|
58 | ||||
|
59 | Should be pretty smart about finding the executable. | |||
|
60 | """ | |||
|
61 | if exe is None: | |||
|
62 | import idlelib | |||
|
63 | p = os.path.dirname(idlelib.__file__) | |||
|
64 | exe = p + '/idle.py' | |||
|
65 | install_editor(exe + ' "$file"') | |||
|
66 | ||||
|
67 | ||||
|
68 | # these are untested, report any problems | |||
|
69 | ||||
|
70 | def emacs(exe = 'emacs'): | |||
|
71 | install_editor(exe + ' +$line "$file"') | |||
|
72 | ||||
|
73 | def gnuclient(exe= 'gnuclient'): | |||
|
74 | install_editor(exe + ' -nw +$line "$file"') | |||
|
75 | ||||
|
76 | def crimson_editor(exe = 'cedt.exe'): | |||
|
77 | install_editor(exe + ' /L:%line "$file"') | |||
|
78 | ||||
|
79 | No newline at end of file |
@@ -47,6 +47,8 b' def main():' | |||||
47 | #ipy_editors.scite() |
|
47 | #ipy_editors.scite() | |
48 | #ipy_editors.scite('c:/opt/scite/scite.exe') |
|
48 | #ipy_editors.scite('c:/opt/scite/scite.exe') | |
49 | #ipy_editors.komodo() |
|
49 | #ipy_editors.komodo() | |
|
50 | #ipy_editors.idle() | |||
|
51 | # ... or many others, try 'ipy_editors??' after import to see them | |||
50 |
|
52 | |||
51 | # Or roll your own: |
|
53 | # Or roll your own: | |
52 | #ipy_editors.install_editor("c:/opt/jed +$line $file") |
|
54 | #ipy_editors.install_editor("c:/opt/jed +$line $file") |
General Comments 0
You need to be logged in to leave comments.
Login now