2

How can I create a keyboard shortcut to switch between the code editor and ipython console using the Canopy IDE?

I have tried writing a macro according to the documentation for code editing (http://docs.enthought.com/canopy/configure/editor-scripting-api.html#code-editor-scripting-commands) and the ipython pane scripting commands (http://docs.enthought.com/canopy/configure/ipython-scripting-api.html#ipython-pane-scripting-commands, but do not see a solution.

As an example, I have a macro that will execute the current line of code (without having to select it), but it would be nice to be able to switch the cursor back to the code editor after execution without touching the mouse/trackpad.

def run():
    code_task = get_active_task()
    code_editor = code_task.active_editor
    cursor = code_editor.cursor
    cursor.start_of_line()
    cursor.next_line(select=True)
    code_task.run_selection()

Using Canopy Version: 1.1.1 (64 bit) on Mac OS X 10.7.5

Minnow
  • 1,733
  • 2
  • 26
  • 52

2 Answers2

1

Thanks, great suggestion. Added to Canopy wish list. (You can use the keyboard shortcut Control+Tab to cycle among File Browser, Editor, and IPython, but this is not yet macro-able.)

Jonathan March
  • 5,800
  • 2
  • 14
  • 16
  • 1
    I look forward to the new feature. Control+Tab is a good start, thanks. Any chance that vi mode will be implemented down the road? For example, R-studio uses ACE (http://ace.c9.io/#nav=about) as a means to implement various editing modes. – Minnow Jan 03 '14 at 22:05
  • Certainly vi mode is a regular -- though not incessant ;) -- request, and it's on our list for triage. I don't see it happening soon, however. – Jonathan March Jan 04 '14 at 01:38
  • Jonathan, can I add one more keyboard shortcut to the wish list? Or maybe it already exists and I just don't know it. Once inside the Editor, it would be helpful to be able to switch between Editor Tabs. Maybe Shift+Tab? – max29 Feb 04 '15 at 00:53
0

(on Mac) -> Better Touch Tool. This is a macro that is only active while i'm in emacs, which does the following:

  • save the current buffer (set to F1 in my emacs)
  • cmd-tab to last other window (terminal)
  • 'Up' arrow (to reload last compile/run cmd)
  • 'Enter' key
  • cmd-tab to last other window (emacs), once process terminates

Has saved me thousands of keypresses today.

screenshot

ryan_m
  • 721
  • 2
  • 7
  • 18