Questions tagged [folding]

Code folding is a feature of some text editors and IDEs that allow some text to be temporarily hidden or "collapsed" in order to hide detail.

Most text editors and IDEs offer some way of hiding sections of the code in order to traverse the code more easily, only view the code currently being edited, and to show an outline of what code currently is in the file.

What code counts as a section and hence can be hidden, can be user specified or automatically added based on the syntax of the language, indentation or tokens (such as brackets).

454 questions
14
votes
1 answer

vim folds open up when giving an unmatched opening brace/parenthesis

I often come across the situation where I have lots of lines folded and I am writing, say a new block of code, above these folds. As soon as I type a '{', all the folds below open up. Even though it is legitimate that vim does this, it is irritating…
r.v
  • 4,697
  • 6
  • 35
  • 57
14
votes
1 answer

org-mode folding considers whitespace as content

Disclaimer: I am new to org-mode. In org-mode, I sometimes add extra empty lines to make the separation between different tasks clearer when they are expanded. Like so: ** Task 1 *** Subtask 1.1 text text *** Subtask 1.2 ** Task 2 The problem…
Tohiko
  • 1,860
  • 2
  • 18
  • 26
14
votes
1 answer

IntelliJ keeps folding my code by default

When I open up any code file .java or .html IntelliJ (12.x) keeps the code folded and I always have to expand everything. How do I make code expand by default?
genxgeek
  • 13,109
  • 38
  • 135
  • 217
14
votes
2 answers

Emacs persistent folding mode

There are plenty of ways to fold code in Emacs and I've settled in on using the outline minor mode... it works great! However, I really want my folding to be persisted when I close and re-open files. It is quite frustrating to have folding set up in…
Chris Holtz
  • 141
  • 3
13
votes
1 answer

opening a fold and jumping to end of it in vim

When I open a fold in vim by zo, I am at starting of opening fold. Then I need to usually jump to end of fold by ]z. Is there any single command for it?
shampa
  • 1,350
  • 3
  • 13
  • 22
13
votes
1 answer

Custom Java Code Folding for Eclipse Helios

I spent a lot of time googling, now I'll try it here. Some of you might know the "regions" available in Microsoft Visual Studio, which allow you to collaps an arbitrary part of your code to just a single line, more or less like // [start] The text…
aRestless
  • 1,825
  • 2
  • 18
  • 27
13
votes
2 answers

How can I fold .cs files inside .xaml files in Visual Studio 2010?

How can I put my ViewModel file (a .cs file) folded inside its corresponded View file (a .xaml file) file like in the image?
user1785721
13
votes
3 answers

Different colors for folds and subfolds in Vim

Is it possible to have different set of colors for folds and subfolds, eg: blue foreground on grey background for fold level 1 (default) black foreground on dark yellow background for fold level 2 etc... (although going further down would seem a…
ThG
  • 2,361
  • 4
  • 22
  • 33
13
votes
3 answers

IntelliJ - Copy only visible text after code folding?

Is it possible to fold large blocks of code in IntellJ, select a section of code that encloses the folded section, and only copy the text that is visible? For instance, if I have a JSON file like: { "list1" : [ 1, 2, …
aaroncarsonart
  • 1,054
  • 11
  • 27
13
votes
4 answers

Vim folding - Close all children recursively under cursor

I know how to open all folds under cursor with zO. But how to do reverse? I want something like za does, but also with recursivity. PS. I know there is zC, but it closes all parent folds in relation to current line and I want to close children.
rofrol
  • 14,438
  • 7
  • 79
  • 77
12
votes
5 answers

Automatic ruby folding in vim

Is there a way that I can setup vim to automatically fold ruby source files, but only fold at the method level regardless of the level that they are defined? So it will fold when I have: class MyClass def method ... end end but also when I…
adivasile
  • 2,377
  • 3
  • 24
  • 32
12
votes
9 answers

NetBeans: Code folds do not appear on one of my PHP files

I'm using the NetBeans IDE. Normally, every PHP file in my project has code folds: However, one PHP file in my project doesn't have code folds: The file has no syntax errors. I've tried restarting NetBeans and reopening the project and the folds…
snakile
  • 52,936
  • 62
  • 169
  • 241
12
votes
3 answers

Code Folding for CSS in VSCode

I can't get code folding to work in the editor in Css. In both html and js I can fold code according to comments, which enables me to create neat groups. But in Css you can't fold comments. Does anyone know of a way to enable this or another nice…
Frank
  • 2,109
  • 7
  • 25
  • 48
12
votes
3 answers

Emacs equivalent of Vim's foldmethod = indent

Question: Does Emacs have a canonical equivalent of Vim's Folding with Foldmethod=indent? I am particularly interested in something that can work alongside any Emacs major mode and any file. The Emacs searches have not turned up a definitive answer.
dreftymac
  • 31,404
  • 26
  • 119
  • 182
12
votes
2 answers

syntax highlighting in a VIM fold header

Is there any way to have VIM continue to apply formatting to the line used as the header for a fold? E.g., I have the following code: int foo(int a, int b) { int c; .... } When folded, I see: +-- 4 lines: int foo(int a, int b)…
Mikeage
  • 6,424
  • 4
  • 36
  • 54