Something I commonly do in files is add a modeline that says use this {{{...}}}
pattern to delimit regions to be folded:
# vim: foldmethod=marker
When vim first opens the file, the text inside the {{{...}}}
will be folded and I will get an overview of the sections of the file.
I can then use "file wide" commands to target all the folded sections, zm
and zr
, or just toggle a specific region with commands like zc
or zo
.
Something worth mentioning
I am running the ultisnips plugin, with snipmate type snippet files in ~/.vim/snippets
.
The problem
When I have a snippet file in ~/.vim/snippets
whose filetype is snippets. e.g. something like this:
filename: ~/.vim/snippets/html.snippets
# vim: foldmethod=marker
# Global snippets
# HTML {{{
snippet font_oswald
<link href='https://fonts.googleapis.com/css?family=Oswald:700,400' rel='stylesheet' type='text/css'>
snippet font_oswald_style
.oswald {
font-family: 'Oswald', sans-serif;
font-style: normal;
font-weight: 700;
text-transform: uppercase;
text-decoration: none;
letter-spacing: 0em;
word-spacing: 0em;
line-height: 1.4;
}
snippet font_roboto
<link href='https://fonts.googleapis.com/css?family=Roboto:400,700,900' rel='stylesheet' type='text/css'>
snippet font_roboto_style
.roboto {
font-family: 'Roboto', sans-serif;
font-style: normal;
font-weight: 900;
text-transform: none;
text-decoration: none;
letter-spacing: 0em;
word-spacing: 0em;
line-height: 1.4;
}
# }}}
vim is not automatically folding the text when I open this file and the "file wide" command zm
and zr
dont work, but the fold specific commands zc
or zo
do still work.
The modeline setting is being recognised, i.e :set foldmethod?
returns
foldmethod=marker
How can I get the "normal" behaviour to work in snippet
files?
update
well I know its something to do with the ultisnips
plugin as the problem goes away when I disable ultisnips.