tags:

views:

767

answers:

3

There is someone in my team that swears by using some kind of GVim feature to do manually code folding.

As I'm using another editor and do not really need the folding feature, I think it only pollutes the source code with tags like:

/* {{{1 */

Convincing the person not to use this folding is not an option (got into some heated discussions before).

I'm not really a GVim guy, I'm wondering if there are not any other ways to do the folding without changing the team's code?

  • Maybe putting the folding directions in a separate file, or
  • Doing some kind of smart folding that takes the syntax of the programming language into account without changing the source code?
+5  A: 

I would imagine he could just add the following to his .vimrc:

set foldmethod=syntax

Assuming he is using a version of VIM that supports that. :)

grieve
+2  A: 

It only took a Google for "vim folding" to discover that Vim supports six fold methods.

syntax, indent and diff all mean that the user has little control over where the folding happens. That may or may not be a problem.

marker is a problem for you because you don't like the markers.

expr had a little of each of those problems, depending on the expression you create.

If your man wants to define his own fold points, and store them in an separate file, it seems like set foldmethod=manual combined with :mkview and :loadview would do the trick.

slim
A: 

You should try it yourself. Once you start using foldmethod=marker there is just no going back. I am working on a project now where I can't use marker folding and it feels like washing clothes in a time before there were washing machines.

Sean