Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handling folds in Spyder

I am coming from a VScode background , and for my recent project (on Deep Learning) I am having to manage huge code files in Spyder (Version 3), and I am not seeing any option of code folding?

I am not willing to switch to another IDE , as Spyder is very productive for my project.

Please suggest any hack to do it , if it is not there in the Spyder codebase.

like image 611
abunickabhi Avatar asked Sep 18 '18 06:09

abunickabhi


People also ask

How do Spyder move panes?

In the Spyder 4.0+ version, go to View menu, unselect "lock panes and toolbars" then you can drag the top area of each pane and move them freely.

How do I indent automatically on Spyder?

How do you show indents on Spyder? Select your code and press Tab or Shift + Tab to indent or un-indent it.

How do you run lines on a Spyder?

In Spyder 4 the keyboard shortcut to run the highlighted lines of code is F9. and if you want to use any other shortcut then you can change it from TOOLS>>PREFERENCES>>KEYBOARD SHORTCUTS then double click on any shortcut you want to change and change with your shortcut.

How do you fold code in Python?

It maps alt+1 to fold the first python indent level (class definitions and functions), alt+2 to fold the second level (class methods), and alt+0 to unfold everything. It makes sure it only folds one level and doesn't fold any of the nested sub levels. You can still use za to toggle folding for the current block.


1 Answers

(Spyder maintainer here) You can install the first beta of Spyder 4 to get code folding.

If you use Anaconda, you need to use the following commands:

conda update anaconda

conda update spyder

or if you use pip, then you need to run

pip install -U --pre spyder

This beta is quite stable and it has been tested for more than a year.

like image 168
Carlos Cordoba Avatar answered Oct 04 '22 22:10

Carlos Cordoba