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
11
votes
3 answers

Two fold methods at the same time

I'd like to set two methods for folding :set foldmethod=indent and retain all its features hiding comments with :set foldmethod=marker :set foldmarker=/*,*/ I found out that this is not possible. Is it possible to achieve the desired folding and…
xralf
  • 3,312
  • 45
  • 129
  • 200
11
votes
3 answers

vim folding messes up syntax highlighting

I'm using vim for LaTeX and I'm using latex-suite. It gives me nice syntax highlighting and folding, but in large files syntax highlighting gets "confused". If I open all folds, the syntax highlighting turns OK. I would like it to "just work" all…
svrist
  • 7,042
  • 7
  • 44
  • 67
10
votes
3 answers

Vim syntax based folding with php

I have downloaded php.vim file, which contains PHP-based syntax information. It should be able to provide syntax based folding, but I can't make it work for some reason. I have set :let g:php_folding 2 and :set foldmethod=syntax but for no avail.…
Masse
  • 4,334
  • 3
  • 30
  • 41
10
votes
3 answers

combine python-mode with org-mode for emacs

I combined org-mode with lisp-mode to achieve beautiful code folding in emacs for lisp code: lisp-orgi-mode. Basically, I use ';' instead of '*' as the heading character. For comments, I just put a space before the ';', making it ' ;' so it doesn't…
Naveen
  • 5,910
  • 5
  • 30
  • 38
10
votes
2 answers

How to save collapsed / folded code in Sublime Text after removal of bufferscroll plugin

Is there a way to save/sync collapsed code from session to session in Sublime Text 3, now that the BufferScroll plugin has been removed?
MartinJH
  • 2,590
  • 5
  • 36
  • 49
10
votes
3 answers

Folding error using //region in Android Studio

After creating a region in Android Studio, located under the end tag of another region, the code folds upward to the end tag of the previous region instead of folding downward through hundreds of lines of code to my //endregion tag for the new…
fernforce
  • 163
  • 2
  • 8
10
votes
2 answers

intellij shortcut - how to fold all javadocs + method implementations

I can't find some IntelliJ IDEA shortcuts. When I go to a class, I want to be able to see only the method signature without additional details. Here is what I mean. Before: And after: Is there a shortcut for this?
catch23
  • 17,519
  • 42
  • 144
  • 217
10
votes
3 answers

how to activate vim folding markers?

I have inherited some c++ code with vim-based folding markers like this: // CONSTRUCTORS/DESTRUCTORS /*{{{*/ Foo::Foo() { } Foo::~Foo() { } /*}}}*/ What do I need to put into my .vimrc to enable folding toggles like zm and space-bar? With my…
kfmfe04
  • 14,936
  • 14
  • 74
  • 140
9
votes
5 answers

Folding over a list of Options to Find First or Last Some

I'm trying to fold over a list of Options in order return the first(or last) Some value or None if there aren't any Some values. scala> val opts = List(None, Some(1), None, Some(2), None) opts: List[Option[Int]] = List(None, Some(1), None, Some(2),…
Trevor
  • 955
  • 9
  • 16
9
votes
2 answers

VIM folds for Everything except Something

A code is over 2000 lines full of folds. I select a certain block in Visual mode to which I would like to start writing. However, things around the block, such as folds, hinder my writing, and I accidentally tend to modify them. Currently, I avoid…
Léo Léopold Hertz 준영
  • 134,464
  • 179
  • 445
  • 697
9
votes
2 answers

Autofold #ifdef..#endif in vim via .vimrc

I have seen partial solutions over the internet but none that really satisfied me: what do I have to put into my .vimrc (ideally I don't want to chance any syntax/*.vim file) such that in all .c/cpp/h files that I open, I get automatic folding of…
dcn
  • 4,389
  • 2
  • 30
  • 39
9
votes
1 answer

is line folded? - How to check for folds in VIM

I'm writing some folding functions and I am at a point where I need to check if the current line is actually a fold. The reason for this is because it is a custom fold method that depends on searching/matching certain lines. For example, if the…
alfredodeza
  • 5,058
  • 4
  • 35
  • 44
9
votes
6 answers

fold/unfold selection only in Notepad++

Notepad++ has commands to fold/unfold all the document. Is that possible to select some of the lines and fold/unfold only the blocks lying inside the selection? EDIT1 Any notepad++ plugin which enables this capability?
Eduardo Poço
  • 2,819
  • 1
  • 19
  • 27
9
votes
4 answers

Can I have Vim ignore a license block at the top of a file?

Is there a way to use folds or some other Vim-script black magic to hide license blocks at the top of files? I don't like that they take up such a large section of my editing pane; I like to get a sense for what a file is doing when I first open it,…
Steven Dee
  • 273
  • 2
  • 7
9
votes
1 answer

How do I make Python folding in vim not visually ruin the whitespace?

When I fold Python code in vim, the fold text always starts in column zero. This is visually noisy since Python has significant whitespace -- it looks like top-level code when I glance through the file. Is there a setting to tell the foldtext to…
Michael Gundlach
  • 106,555
  • 11
  • 37
  • 41