Questions tagged [folding]

A feature which lets visually hide (and toggle) regions of a text file, by replacing its contents with a single outline line.

Filter by
Sorted by
Tagged with
21
votes
8answers
5k views

Is there a best practice to fold a vimrc file

I recently realized that my vimrc is now more than 400 lines long (which IMO is too much I'll try to reduce that) and to make it easier to navigate, read and edit it I decided to investigate the ...
13
votes
1answer
1k views

Folding by regex search pattern

I got a plain text file with whitespace separated columns of values. Like this: AU 3030 .... ... .... AU 3031 .... ... .... AU 3032 .... ... .... AU 3033 .... ... .... IT 48100 ... .. ..... IT ...
13
votes
1answer
3k views

Can I save folds?

Today I learned how to fold/unfold in Vim; it's quite handy. Unexpectedly, when I exit a file and reenter it, the folds I created are gone (unfolded). In our company's large project there are ...
9
votes
3answers
4k views

How to write a fold-expr?

I have read the help page about fold-expr (:h fold-expr) but it didn't explain what's the syntax used in the expression. There were there four examples: :set foldexpr=getline(v:lnum)[0]==\"\\t\" :...
7
votes
1answer
569 views

How to map Enter to custom command EXCEPT in quick fix?

I've remapped <cr> (enter) to za so I can quickly open/close folds. However, now when I use the quickfix window and hit enter it no longer jumps to the line with the error (because it's trying ...
6
votes
2answers
3k views

How to open a file with all folds opened?

I've got the following line in my _vimrc file which enables folding for my PHP (and other) files: set foldmethod=indent However, whenever I open a file it starts with every fold closed, but I would ...
6
votes
2answers
209 views

Syntax file: keywords within context

I have a language which uses statement like WHILE ... DO .. END_WHILE I can do the following in the corresponding synthax file syn keyword LangKeys WHILE DO END_WHILE syn region LangBlock start="...
3
votes
0answers
104 views

how to delete a paragraph respecting the folds?

I have a file (filetype=javascript), this is how it looks without folds: and with folds: I can move with the { and } motions skipping the empty lines inside the folds (thanks to these question and ...
8
votes
2answers
706 views

Is there a way to conceal across lines?

Here is my use case: I have lots of code which because of style enforcement we write newlines after and before each open and close brace (respectively). Example: function func(args) { ...
7
votes
2answers
202 views

Is there a way to disable the foldexpr during autocomplete?

I've noticed that vim's fold method affects the efficiency of autocomplete, e.g. C-N is slow, and C-X L is hideously slow in medium sized files with relatively expensive foldexprs. I can't see the ...
6
votes
2answers
1k views

How to save a view (with folds) into the file?

I just recently learned how to use folds and I find it very useful. I have added a rule to automatically save the view with my folds when I'm editing the markdown files with the rule: augroup ...
1
vote
1answer
122 views

Fold: foldtext() for each filetype

how to have foldtext() for each filetype, because each filetype has different kind of fold so multiple foldtext() in vimrc and enable for each filetype. I'm thinking about multiple foldtext() ...
0
votes
1answer
52 views

Define a fold that can not be searched, and that isn't affected by other fold commands?

POD is a markup file that is used by Perl. It's a pretty unreasonable documentation format that has nothing to do with perl (accept for being the only known use-case), and it's sometimes found ...