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 concept of folding in vim (which I wasn't familiar with).
- I tried to set the folding method to
indent
but I didn't like the result (It was too messy mostly because a great part of myvimrc
isn't really indented). - I also tried to set
foldmethod
toexpr
andsyntax
but I wasn't able to fold anything properly. - Here using
diff
as folding method doesn't seem relevant. (Or if it is I didn't understand how to use it) - So for now I'm using the
marker
method which doesn't totally satisfy me because of the"{{{
and"}}}
markers which I found "noisy" in the file.
So I'd like to know if there are best practices or common guidelines about properly folding a vimrc
.
Note 1: As we all know SO isn't a forum and isn't made to collect personal opinions and that's not what I'm looking for: of course I guess some people has their preferences but I'd like to know why using markers (for example) improves the readability more than using indent.
Note 2: Also my main goal is to make my vimrc
as clear as possible so if other best practices exists to create a nice vimrc
I'm curious about it.
Edit 1: I should have precised that my vimrc
is already subdivided in sections (and sometimes subsection) the main ones being
- general options
- plugins (containing a subsection for each plugin and its configuration)
- mappings
- navigation (also containing subsection)
- color
- etc...
And it's this structure which made me thought of folding: I feel that being able to output only the section I'm interested in at a certain point is something pretty convenient.
Edit 2: Answer mentioning subdivisions of the vimrc
in several files are valid, but as a personal preference I'd rather use folding because I think it is easier to maintain only one file in the git repo containing my dotfiles. That is only a personal preference and I'm aware that is it possible to also use this approach but I'd prefer to use folding.
"{{{
is the most 'vim like' way of doing things, the solarized plugin uses this and although it might be noisy it gives you the most standard way of setting manual folds