Search code examples
pythonkeyboard-shortcutsspyder

Modify/create Spyder keyboard shortcuts `%clear` and `%reset`


What I would like to do:

I would like to modify/create keyboard shortcuts in Spyder to 1) clear the console (regardless of where my cursor is!), and 2) reset the variable explorer.

What I have done so far:

So far I am able to do these as follows:

  1. clear the console:
  • enter %clear in the console
  • ctrl + L when my cursor is in the console
  • cmd + L when my cursor is in the console
  1. reset the variable explorer
  • enter %reset in the console

I have been able to modify other keyboard shortcuts via Tools > Preferences > Keyboard shortcuts as described in another SO question. However, I haven't been able to modify/create the shortcuts for %clear and %reset.

Software Versions/OS:

I am running Spyder 5 with Python 3.9 on a MacBook OS BigSur 11.3.

Thank you for your help!


Solution

  • (Spyder maintainer here) Right now (May 2021) it's not possible to customize the %clear shortcut.

    However, you can customize the %reset one by going to Preferences > Keyboard shortcuts and selecting the action called reset namespace, as shown below

    reset shortcut