I am a big fan of the ability to create folding right in the syntax
files. What better place to define folding based on the syntax of the
file, than right in the syntax file? I sometimes find myself wishing
that I could do the same thing to define _indentation_ based on the
syntax of the file. Why not create the ability to do something like
this:

syntax region braceIndent start="{" end="}" transparent indent

This would work exactly the same way for indentation as the example
given in :help :syn-fold works for folding. I.e. it would increase the
indent level by one shiftwidth at the start region, and decrease it
again at the end region (the example would need to be tweaked to
offset it by a line, or the line-offsets could be built-in).

Unlike syn-fold, however, it would make sense to also allow syn-indent
within a syn-match. The behavior on a match would be slightly
different though, because it should not decrease the indent again
after the match.

This feature would prevent the need to write a complicated indentexpr
that probably looks at many of the same things that the syntax file
already looks at.

If this was implemented, a new 'indentmethod' option would probably
need to be introduced similar to 'foldmethod', with at least 'expr'
and 'syntax' values defined. It could be nice to have it over-ride all
the other indent options as well, additionally defining 'auto',
'smart', 'c-style' and any other I missed.

What do people think?

Sorry if this has already been suggested...I briefly searched this
mailing list and didn't find anything, but that's the only place I
looked.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui