I am in a project with 3 people. We need to have the same folds in Vim for each member. How can I share my folds?
[Feedback]
I understood one important thing: Google ignores signs, such as {{{, so please google "VIM three braces" to find help about the marker-method. It becomes much easier to practise, as you can quickly find relevant information.
In order to use the the marker-method (suggested by Adam Bellaire), please note that you have to set the method:
:set foldmethod=marker
Thanks for your answers!
Probably the easiest way is to just use fold markers (e.g. {{{1
), making sure to include the vim:fdm=marker
setting in the file itself. For example, here's a shell script which contains both the setting to use fold markers and two levels of fold:
#/bin/sh
# vim:fdm=marker
echo This file contains fold markers.
#Top Level Fold {{{1
echo This is a top-level fold.
#Second Level Fold {{{2
echo This is a second-level fold.
Opening this file in vim will show the first four lines and then a fold, which if expanded will reveal the second fold. Just make sure to put a space between your comment syntax and the vim:fdm=marker
line or vim won't see it. For example, in C you could use:
// vim:fdm=marker
Folds in files ? Well, same settings should result in same folds.
Vim can fold in several ways: manually, by indent, by expression, by syntax, and by markers (by default, I believe are curved brackets, 3 of them).
So if you have the same vim version, and they haven't changed their syntax and indent files, let them check out your vimrc for foldmethod and foldmarker options, and copy them to their vimrc files. That should do it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With