# Code folding in Kile

Kile allows me to fold the ocde in between begin-end blocks. However, I am interested in manually grouping parts of the text. Is there a way to do that?

To give an example from another IDE, Netbeans offers code blocks by putting code in between the specific comment lines as follows:

// <editor-fold defaultstate="collapsed">
// </editor-fold>


Is there such a structure for Kile? I couldn't find it so far.

This will be especially useful for folding references in the bibliography file which I am editing via Kile.

Thanks,

% BEGIN
<lots of stuff>
% END


You can add stuff after the BEGIN/END, too. For example, I'll often add a label or something for easy identification.

For example, suppose my document looks like this:

So I've got 2 custom blocks of code which can be folded:

% BEGIN blocks
...
% END blocks


and

% BEGIN paths
...
% END paths


Then I can fold the code in the usual way:

• Didn't work. Can it be a version issue? I am using Kile Version 2.1.3 Using KDE Development Platform 4.13.3 – osmanlioglu Apr 27 '16 at 5:12
• I have 2.1.3 with platform 4.14.19. But this has worked for a long time for me. See above - this is what you meant, isn't it? – cfr Apr 27 '16 at 20:05
• Exactly. It worked now. I guess, I have been trying it in the .bib file (which is what I was actually looking for). It works well with the .tex file. Thanks for the extra information and screenshots. – osmanlioglu Apr 28 '16 at 18:01
• I'm not sure I've tried with a .bib file. However, check in the settings what schemas Kile is applying to those files as it makes a difference to various kinds of things. (I don't know if it will change this, mind. Just it often helps.) – cfr Apr 28 '16 at 18:45
• I have noticed that this solution does not work just below \ section{xxx}, but it works if you put "\label{xxx}" just after the section, then you can put the "% BEGIN block ... % END block". – Rodrigo Mar 10 '17 at 15:15