Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim folding - mark opened folds

Tags:

vim

folding

Is there a way to see, where are opened folds in current File? I personally have the problem when opening folds and moving around, I'm not able to find the line where the fold was started from! Maybe there is an option to set a nice-looking folding-hint next to the numbers. Maybe like this:

+ 1 void myfunc(void) {
| 2     printf("Hello World\n");
| 3     printf("Goodby World!\n");
- 4 }
  5
  6 void anotherfunc(void)
...

it would be very nice! I already used google and also used the vim-help but found no way to do this.

Kind regards, musicmatze

like image 414
musicmatze Avatar asked Jun 10 '12 09:06

musicmatze


People also ask

How do I close a fold in Vim?

Running zc in normal mode will close all the folds after using zO . The zr command will open all first-level folds in Vim, and zR will open all of the folds in the file. The zm command will re-fold the first-level folds, and zM will close all open folds in a file.

How do I expand all lines in Vim?

To expand the lines, put the cursor over the fold and hit spacebar (in vim terminology, this deletes the fold). (Side note: you may want to change the look of collapsed folds. My ~/.

How do I mark in Vim?

Setting marks To set a mark, type m followed by a letter. For example, ma sets mark a at the current position (line and column). If you set mark a, any mark in the current file that was previously identified as a is removed. If you set mark A, any previous mark A (in any file) is removed.

What is text folding?

Code or text folding, or less commonly holophrasting, is a feature of some graphical user interfaces that allows the user to selectively hide ("fold") or display ("unfold") parts of a document. This allows the user to manage large amounts of text while viewing only those subsections that are currently of interest.


1 Answers

Try :set foldcolumn=1

if you want more fold columns indicators increase the number, the example below uses :se fdc=3 (the shortcut)

enter image description here

like image 118
Eric Fortis Avatar answered Sep 30 '22 12:09

Eric Fortis