On 23.07.15 13:40, Nelo-Thara Wallus wrote:
> In modelines you have to escape the colon (if your foldexpression is more
> complicated than `getline(v:foldstart)`
Many thanks. I'll try that. (In the morning. It is growing late here.)
> you should consider using its own function for readability and
> extendability)
I'll consider anything which is more elegant than the starting point,
but as ":h modeline" hammers home, no matter how many times I go back to
look, "There are two forms of modelines." I.e. Explicit and implicit
"set" directives. Nothing else.
If you can suggest how to invoke from a modeline, the function I've
already been using, listed in the post to which you replied, then I'd be
both impressed and appreciative.
> The best way is to give your files proper endings and to use filetype files
> (`~/.vim/ftplugin/$filetype.vim`). If you use filetypes unkown to vim you have
> to use a ftdetect file (`~/.vim/ftdetect/$filetype.vim`, more info[1] - it's
> really just an augroup).
That looks like a value judgement from here. ;-)
It is not the *nix way, and seems to me a right royal PITA to
administer. Using a suffix identifying foldmethod seems a very limiting
solution, since that excludes other custom handling, unless multiple
suffixes are added to the filenames. (They'd then be modelines on the
outside of the file.) Alternatively, generating a different suffix for
each of my files is easy enough I suppose, since any random guff would
do, and will handle 238328 files, just using [a-zA-Z0-9]. But that is
merely an externally visible alternative to all the autocommands I
deprecated in my OP. And generating a filetype file for each text file
would have me thinking I'm on a Mac.
I'm very happy with using modelines. It's rather like *nix file magic,
just much more customisable, and can be tacked on the end of the file
in order to be less intrusive.
For the moment, I'm experimenting with a modeline of:
vim: foldmethod=marker foldopen-=block foldtext=MyFoldText() commentstring=
and the contents of the function in the OP as default. So long as I
don't come up with a complex third alternative, that works. It does
force me to add a modeline of " vim: foldmethod=manual" in files not
using folding, since the new default does not implicitly handle that.
Thanks again for taking time to think about my quandary, especially when
it's midsummer up there.
Erik
--
Victorian paramedics were called to more than 200 cases of children locked in
cars in the first five weeks of 2015. Last year more than 1,100 children were
rescued from inside locked cars.
- http://www.abc.net.au/news/2015-02-20/toddler-found-dead-kyneton-police-continue-investigations/6158496
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thursday, July 23, 2015
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment