Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python folding is bad #8307

Closed
ipsod opened this issue Feb 4, 2017 · 5 comments
Closed

Python folding is bad #8307

ipsod opened this issue Feb 4, 2017 · 5 comments
Labels
- Forum - Folding Python stale marked as a stale issue/pr (usually by a bot)

Comments

@ipsod
Copy link

ipsod commented Feb 4, 2017

Good folding

See Vim, PyCharm with IdeaVim, or org-mode for a decent implementation of folding. Unfold one level, and the levels below it remain folded, giving you an outline.

Evil folding problems

Unfolding a region unfolds all sub-regions. This basically ruins any benefit of folding.

Origami folding problems

Folds are only one-level deep. Methods inside of classes, for example, are not fold-able.

People said that Origami is better than Evil, but Origami can't even fold class methods - am I missing something?

Vimish-Fold problems

No syntax-based folding.

Solution?

I don't know how people can browse code without proper folding. Is there some navigation method I'm missing?

I've tried helm-jump-in-buffer, but it's way more clunky than code folding, since it always starts from the top instead of relative to where you are in code, and is an abstraction instead of a direct representation of code.

@ostrbor
Copy link

ostrbor commented Feb 6, 2017

I use C-c @ ...
Also imenu

@braham-snyder
Copy link
Contributor

braham-snyder commented Feb 7, 2017

syntax-based folding

For https://github.com/alexmurray/evil-vimish-fold, https://github.com/syl20bnr/spacemacs/blob/master/doc/DOCUMENTATION.org#indent-text-object works quite well.

Unfortunately, vimish-fold (upon which evil-vimish-fold depends) still lacks folds over folds (if you're reading this and would like to see this feature implemented, I think it would help to go thumbs-up that issue).

@vv111y
Copy link

vv111y commented Oct 12, 2018

100X yes, this is a major pain point.
Right now I am very grateful for Treemacs, I expand files to visualize the structure of the code. But the files need to be in a project that is manually added to treemacs, this is not available for an arbitrary file.
I gave thumbs up for that issue @braham-snyder. I'm surprised in all of emacs-land this has not been done

As @ostrbor says, hideshow might be what to use for now https://www.reddit.com/r/emacs/comments/746cd0/which_code_folding_package_do_you_use/

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Feb 29, 2020
@mixmixmix
Copy link

mixmixmix commented Jul 27, 2023

Hello, I've circled back to this issue - I cannot find any way of indentation-based folding in Python (tried all three origami/vimish/evil to no avail). The best I can do is to fold whole functions and classes in evil.
Anything eveolved in this regard since 2020?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- Forum - Folding Python stale marked as a stale issue/pr (usually by a bot)
Projects
None yet
Development

No branches or pull requests

6 participants